Sahil Dave
Sahil Dave

Reputation: 353

Checking Request Attribute in JSP

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 value I set in the attribute, the condition always evaluates to false. Is the attribute not visible inside the condition?

Sahil

Upvotes: 4

Views: 8255

Answers (1)

Hamed
Hamed

Reputation: 1432

Try this instead:

request.setAttribute("submitted", true);

and in your JSP:

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

Upvotes: 6

Related Questions