On Friday 27 June 2003 09:26, [EMAIL PROTECTED] wrote:
> Hi James,
>
> So what does the name portion of the bean:define actually do ( I've done
> the RTFM but I'm still confused ).
> Is the name the name of the value in pageContext() and id the scripting
> value on the jsp page?

I know, the docs can be a little intimidating.

Here's (more or less) what you've provided us:

<logic:iterate id="thread" name="page_of_results" indexId="index">
 <bean:define  id="hot_topic" name="hot_topic" value="false" />
 <logic:greaterThan name="thread" property="replyCount" value="100">
    <bean:define id="hot_topic" name="hot_topic" value="true"/>
 </logic:greaterThan>

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

From this I am assuming:
 - You are iterating over a collection of beans.  
    (I'll call them TopicBeans for now.)
 - You've placed this collection in the request (or some scope) under the name
   "page_of_results".

Now you want to know if the number of replies to that thread are greater than 
100 (thread.getReplyCount() > 100)
If so, then show the "hot_topic.gif" icon.

Am I on target so far?

If so, first thing I would do is pull that logic out of the tags.  Hell, pull 
it out of the page altogether.  Make this configurable via the bundle.  Add a 
boolean to your bean isHotTopic.  In your action, check to see if the number 
of threads is greater than 100 (or some parsed value from your properties 
file).

So you should be able to do this:
<logic:iterate id="thread" name="page_of_results" indexId="index">
 <logic:equal name="thread" property="hotTopic" value="true">
  <html:img page="/images/hot_topic.gif"/>
 </logic:equal>
</logic:iterate>


>
> Thanks
>
> Ben
>

BTW. I also fixed your image tag, you should never hard-code your 
application's context in your pages.


-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx



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

Reply via email to