开发者

Checking Request Attribute in JSP

开发者 https://www.devze.com 2023-04-09 18:35 出处:网络
I am trying to check a request attribute in a jsp to show/hide certain html. request.setAttribute(\"submitted\", \"true\");

I am trying to check a request attribute in a jsp to show/hide certain html.

request.setAttribute("submitted", "true");

jsp:

<c:if test="${submitted == 'false'}">
  // some html
</c:if>

But no matter what开发者_JAVA技巧 value I set in the attribute, the condition always evaluates to false. Is the attribute not visible inside the condition?

Sahil


Try this instead:

request.setAttribute("submitted", true);

and in your JSP:

<c:if test="${submitted}">
    // some html
</c:if>    
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号