Reputation: 1443
I'm trying to make a simple login with JSP, and I have a custom tag like this
<h:mainwrapper>
with some simple div's inside... and what i'm trying to do is to execute <%=error %>
inside that custom tag.
I get the following error:
org.apache.jasper.JasperException: /login.jsp(38,8) Scripting elements ( <%!, <jsp:declaration, <%=, <jsp:expression, <%, <jsp:scriptlet ) are disallowed here.
Code-example:
<h:mainwrapper>
<h:topempty />
<div style="margin: auto; width: 300px; height: 300px; border: 1px solid black; margin-top: 100px;">
<div style="width: 170px; height: 250px; margin: auto; text-align: center;">
<form action="LoginCheck" method="post">
<p>Login name:</p>
<input type="text" name="loginname" />
<p>Password:</p>
<input type="password" name="loginpass" /><br />
<input type="submit" name="submit" value="Login" />
</form>
<div style="color:#f00;">
<%=error %>
</div>
</div>
</div>
</h:mainwrapper>
Do I have to enable something to let this be allowed?
Upvotes: 0
Views: 2257
Reputation: 1108742
Use EL. Assuming that error
is been set as an attribute in page, request, session or application scope, then you can just do
${error}
Upvotes: 1