Reputation: 5668
How can I print a HTTP Request parameter inside of a <jsp:body>
?
The following doesn't work.
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>
<t:basePage>
<jsp:attribute name="title">Reset Password</jsp:attribute>
<jsp:attribute name="lib">lib/</jsp:attribute>
<jsp:attribute name="bodyClass">loginPage</jsp:attribute>
<jsp:body>
<%= request.getParameter("msg"); %>
</jsp:body>
</t:basePage>
I get this error:
HTTP Status 500 - /message.jsp (line: 39, column: 22) Scripting elements ( <%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here.
Upvotes: 0
Views: 2687
Reputation: 5108
Try with Expression Language
${requestScope.param.msg}
OR simply
${msg}
may be your configuration disables scripting elements.
EDIT
This does not relate to your current requirement since scripting elements seem to be disabled at your end. However the below is syntactically incorrect
<%= request.getParameter("msg"); %>
You must never add a ;
after expression_here
<%= #expression_here %>
for the simple reason that it translates to out.print(msg;);
which is syntactically incorrect.
Upvotes: 1