This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes how to compare two variables in struts logic:equal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to compare two variables in struts logic:equal" Watch "how to compare two variables in struts logic:equal" New topic
Author

how to compare two variables in struts logic:equal

zimbu bolleddu
Ranch Hand

Joined: Jan 14, 2008
Posts: 35
Hi all,

I'm new to struts,

how to compare two variables in <logic:equal > tag.

variables something like : <% var1 %> and <% var2 %>.

please give me an example...!

Thanks in advance
Suresh Kumar
Greenhorn

Joined: May 26, 2008
Posts: 6
Hi,

For comparing two request parameters, you can use

<logic:equal parameter="password" value="${ param.userName }">
Hi User, Thanks for visiting!!!
</logic:equal>

You can also compare attributes of a bean against constant values/rumtime expressions.

<logic:equal name="loginForm" property="username" value="user001">
Hi user001, Thanks for visiting!!!
</logic:equal>

Hope it is useful.

Suresh.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to compare two variables in struts logic:equal
 
Similar Threads
Comparing values in struts using logic:equal..
logic:equal
logic:equal compare two values
logic:equal
simple struts conditional?