In this code excerpt I am defining a bean with bean:define. However, I
want to conditionally change the value.

According to the struts doc, bean:define either creates, or replaces a
previous instance of the bean as defined by the id. However, I can't
see how this is possible, as the bean:define actually writes inline
java i.e <bean:define name="blah" id="blah/> --> Object blah = "";


<logic:iterate name="page_of_results" indexId="index" id="thread">

<bean:define scope="page" name="hot_topic" value="false"
id="hot_topic"/>


<logic:greaterThan name="thread" property="replyCount" value="100">
    <bean:define scope="page" name="hot_topic" value="true"
id="hot_topic"/>
</logic:greaterThan>

.

..

....
<logic:equal name="hot_topic" value="true">
<img src="/midletsite/images/hot_topic.gif"/>
</logic:equal>
</logic:iterate>


I've tried replacing the other bean:defines with scriptlets eg,

<logic:greaterThan name="thread" property="replyCount" value="100">
  <%hot_topic="false"%>
</logic:greaterThan>

but the bean:write later on seems to have ignored the scriptlet (
possibly due to the compilation order of the JSP vs. tags?

Can anyone provide a workaround?

Thanks

Ben

Reply via email to