<logic:equal> and <bean:write>


General J2EE: <logic:equal> and <bean:write>

  1. <logic:equal> and <bean:write> (5 messages)

    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"/>

    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"/>

    I would prefer not to use a scriptlet, i would prefer to use the tag libraries when i can.. anyone?

    Threaded Messages (5)

  2. Just found out...[ Go to top ]

    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?
  3. Re: Just found out...[ Go to top ]

    Try this:
  4. 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.

  5. .[ Go to top ]

    you're doing too much on the jsp page
  6. -[ Go to top ]

    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.