Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comparing values in struts using logic:equal..

 
Sam Drake
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to know whether its possible to compare 2 variables in struts.
I have 2 variables say strName1, strName2 in the page context.
How can i compare them in struts to be of the same value using logic:equal
<logic:equal name="strName1" value="???" >
....
....
</logic:equal>
Any idea...
Please help.
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API documentation states that value is a constant value. It can, however, be a runtime expression so you can compare it would be to do something like so:
<logic:equal name='var1' value='<%= pageContext.getAttribute("var2") %>' >
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic