views:

968

answers:

1

I have to compare this to a value like below:

${page_id } ---- <% out.print(a); %>

<c:if test="${page_id != a}">

How can I do this?

+1  A: 

Presuming that "a" is a scriptlet variable. El expressions map to page/request/session/application attributes in scope.

${page_id} is approximately equivalent to pageContext.findAttribute("page_id");

To be able to compare them, you need to get them into the same space. One way of doing this is with scriptlet code:

<% pageContext.setAttribute("a", a); %>

You should now be able to access ${a} as an EL expression. Not a preferred solution, as it uses scriptlet code (something to avoid in JSPs) There might be a better way of course. It all depends on where the value of "a" come from in the first place.

evnafets