You typed <% =myint %> instead of <%= myint %> !

I used this a lot of time :

<logic:equal name="topicsList"
             property="topicid"
             value="<%= MyClass.CONSTANT_VALUE %>">
     foo
</logic:equal>

Nico.

> Hi,
>
> I'm using Struts 1.1b and want to use <logic:equal> to compare values
> and I'm totally stuck when I try to use no constant for the value
> attribute...
>
> My code this:
>
> I have a formbean named "ListExperimentForm" with a getter method
> "getTopics()" to return a collection of Objects each containing a
> private int member variable "topicid"
>
> I would like to check inside the iteration if the topicid matched a
> runtime expression. That could be a get parameter or any scripting
> variable. But I don't get it work.
>
> <logic:equal name="topicsList" property="topicid" value="5"> is fine...
> but I can't use a constant value attribute, of course.
>
>
> If I for example try:
>
> <% int myint = 5; %>
> <logic:iterate id="topicsList" name="ListExperimentsForm"
> property="topics">
> <logic:equal name="topicsList" property="topicid" value="<%
> =myint %>">
> DOSOMETHINGCONDITIONAL
> </logic:equal>
> DOSOMETHING
> </logic>
>
> nothing happens if topicid == 5...
>
>
> I guess this is because of:
>
>   /* ----  logic:equal ---- */
>     org.apache.struts.taglib.logic.EqualTag _jspx_th_logic_equal_3 =
> (org.apache.struts.taglib.logic.EqualTag)
> _jspx_tagPool_logic_equal_value_property_name.get(org.apache.struts.tagl
> ib.logic.EqualTag.class);
>     _jspx_th_logic_equal_3.setPageContext(pageContext);
>     _jspx_th_logic_equal_3.setParent(_jspx_th_logic_iterate_0);
>     _jspx_th_logic_equal_3.setName("topicsList");
>     _jspx_th_logic_equal_3.setProperty("topicid");
>     _jspx_th_logic_equal_3.setValue("<% =myint %>");
>
> So "topicid" is not compared to the value of myint, instead it's
> compared to the string "<% =myint %>"...
>
> I'm confused. Especially after reading examples like:
> http://j2ee.masslight.com/Chapter5.html
>
> I can't see the difference... How can I solve this issue with runtime
> expressions?
> I've tried it with other struts tags, too.... Whenever I need to put a
> scriptlet variable into e.g. a value attribute of a tag, nothing works
> as expected.
>
>
> Thanks for any hint... I'm getting gray hair and think about using
> scriptlets instead of struts tags, if I don't find out what's wrong
> soon...
> Michael
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to