java - How do I convert this simple scriptlet to JSTL? -
i have following scriptlet i'm trying convert jstl
<% string req = request.getparameter("loginfailed"); if(req != null) { if(req.equals("true")) {%> <h4 id="loginerrormessage">invalid email address or password.</h4> <%} } %>
this scriptlet works fine, i'm trying convert jstl new to. best attempt @ recreating logic using jstl.
<c:set var="req" value="${request.getparameter(\"loginfailed\")}"/> <c:if test="${ req!=null }"> <c:if test="${ req.equals(\"true\") }"> <h4 id="loginerrormessage">invalid email address or password.</h4> </c:if> </c:if>
when replace scriptlet jstl have written above, nothing crashes no longer see "invalid email address or password." when have seen using scriptlet. i'm not sure i'm doing wrong here.
is scope issue? figured default page scope fine c:set. have fact i'm using escape quotes in jstl?
just use
<c:if test="${ param.loginfailed eq 'true' }"> <h4 id="loginerrormessage">invalid email address or password.</h4> </c:if>
here param
implicit jsp object gives access request parameters.
Comments
Post a Comment