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

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

SQL Server - MyCTE query based on 24 hour period (next day) -