wood burning stoves*
The moose likes Struts and the fly likes How to replace a if(boolean) script with struts tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to replace a if(boolean) script with struts tag?" Watch "How to replace a if(boolean) script with struts tag?" New topic
Author

How to replace a if(boolean) script with struts tag?

Henry Sun
Greenhorn

Joined: May 09, 2003
Posts: 18
Hi, friends,
I have a bean with a boolean property "isPrimary" inside. I want to use it as a condition in my jsp page just like this:
<% if(myBean.isPrimary){
.... %>
My question is how can I replace this script by using struts tag, like <html:equal> or something else?
thanks.
henry
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4446
    
    5

use the logic tag:
<logic:equal name="myBean" property="primary" value="true">
...
</logic:equal>


Junilu - [How to Ask Questions] [How to Answer Questions]
Henry Sun
Greenhorn

Joined: May 09, 2003
Posts: 18
Originally posted by Junilu Lacar:
use the logic tag:
<logic:equal name="myBean" property="primary" value="true">
...
</logic:equal>

In my bean, I am following the javabean rules for boolean property by defining the getter method like this: public boolean isPrimary(). But <html:equal> seems like to get any property by using exactly "public boolean getIsPrimary()". I've tested this way, it works. But is there any other way or tags to get it working?
Thanks your reply.
henry
Henry Sun
Greenhorn

Joined: May 09, 2003
Posts: 18
Originally posted by Henry Sun:

In my bean, I am following the javabean rules for boolean property by defining the getter method like this: public boolean isPrimary(). But <html:equal> seems like to get any property by using exactly "public boolean getIsPrimary()". I've tested this way, it works. But is there any other way or tags to get it working?
Thanks your reply.
henry

Forget my last post. It works with your suggestion by <logic:equal name="myBean" property="primary">. I was still using "isPrimary" in the tag, so it doesn't work.
Thanks.
Henry
 
jQuery in Action, 2nd edition
 
subject: How to replace a if(boolean) script with struts tag?
 
Similar Threads
Security Related Error in Servlet Application
How to pass a data through html:link in struts
How can I use hyper link when submit a form?
How can I validate my Data
Replace tag value using Ant Script