Dear all,
How come I can't write this:
<logic:iterate id="ms" name="maritalStatuses">
<logic:equal name="ms" property="value" value="<bean:write name='member' property='mbrMaritalStatus'/>">
<bean:write name="ms" property="label"/>
</logic:equal>
</logic:iterate>
But, when I write this, it works:
<bean:define id="test" name="member" property="mbrMaritalStatus" type="java.lang.String"/>
<logic:iterate id="ms" name="maritalStatuses">
<logic:equal name="ms" property="value" value="<% test %>">
<bean:write name="ms" property="label"/>
</logic:equal>
</logic:iterate>
I would prefer not to use a scriptlet, i would prefer to use the tag libraries when i can.. anyone?
-
<logic:equal> and <bean:write> (5 messages)
- Posted by: Ryan Allaby
- Posted on: May 30 2005 12:17 EDT
Threaded Messages (5)
- Just found out... by Ryan Allaby on May 30 2005 12:31 EDT
- Re: Just found out... by James Jithin on May 05 2009 06:47 EDT
- <logic:equal> and <bean:write> by Stephane Vaucher on May 31 2005 11:21 EDT
- . by Jason Frank on May 31 2005 19:41 EDT
- - by Jason Frank on May 31 2005 19:47 EDT
-
Just found out...[ Go to top ]
- Posted by: Ryan Allaby
- Posted on: May 30 2005 12:31 EDT
- in response to Ryan Allaby
I was doing some reading and one guy out on the internet says that you cannot use bean:write inside the property attribute of another tag...
Is there another elegant way to do what i would like? -
Re: Just found out...[ Go to top ]
- Posted by: James Jithin
- Posted on: May 05 2009 06:47 EDT
- in response to Ryan Allaby
Try this: -
<logic:equal> and <bean:write>[ Go to top ]
- Posted by: Stephane Vaucher
- Posted on: May 31 2005 11:21 EDT
- in response to Ryan Allaby
Try using a <bean:define... tag. I haven't done struts tags in over a year, but I believe that you should be able to declare a "member" bean, and use the member to check the equals.
sv -
.[ Go to top ]
- Posted by: Jason Frank
- Posted on: May 31 2005 19:41 EDT
- in response to Ryan Allaby
you're doing too much on the jsp page -
-[ Go to top ]
- Posted by: Jason Frank
- Posted on: May 31 2005 19:47 EDT
- in response to Jason Frank
as in, you should be doing as much processing in the controller, and your logic on the jsp page should be kept to a minimal and should relate more to layout then complex decisions based on comparisons of arbitrary bean fields.
so in this case, you should have a layout bean that should be populated correctly based on your control logic, and then your struts tags should do simple boolean tests to lay it out.