Subject: Re: Empty and Equal
From: "Tim Chen" <[EMAIL PROTECTED]>
 ===
Sorry, clarify a bit on part 1.

i have found a way to do this using bean:size and then checking using
logic:equal versus logic:notEqual but I was wondering more on if there was a
one liner (or taglib) solution that I could use.

Currently, the code looks like:

<bean:size id="dTypeCnt" name="specification" property="detailTypes"/>

<div style="margin-left:20;color:#ff0000;font:smaller">

<logic:notEqual name="dTypeCnt" value="0">

Detail Types<br/>

</logic:notEqual>

<logic:equal name="dTypeCnt" value="0">

Summary Types<br/>

</logic:equal>

</div>

That works fine. but is there a way to do it better/more concisely?

-Tim

"Tim Chen" <[EMAIL PROTECTED]> wrote in message
news:a604t7$s4g$[EMAIL PROTECTED].;
> Hi all,
>
> 1) Didnt the struts taglib use to have a way to test if a collection is
> empty?
>
>     I cant seem to find it anymore.
>
>     I have a bean that contains an ArrayList.
>
>     I want to Output a message if that ArrayList is empty.
>
>     I also want a header if it is notEmpty.
>
>     I could use the iterate tag but that would print the header for each
> iteration of the tag
>
>     unless I use some scriptlets to check inside the tag (which defeats
the
> whole purpose of using taglibs i think).
>
> 2) I am using the equal and notEqual of the logic tag to check for a
> constant value. That works fine.
>
>     However, I would like to use it to match a value coming from another
> Bean. Is there a way to do this with out using scriptlets? Perhaps another
> taglib from a a different library?
>
> ex.
>
> Bean1
>
>     int beanID;
>
>     String beanDesc;
>
> Bean2
>
>     int beanID;
>
>     String beanDesc;
>
> in session:
>
> mybean1 = Bean1;
>
> mybean2 = Bean2;
>
> how can i do:
>
> <logic:equals name="mybean1" property="beanID" value="mybean2.beanID"
> scope="session">
>
>     <bean:write name="mybean1" property="beanDesc"/>
>
> </logic:equals>
>
> I've tried using the above and also using a bean.write to get the value of
> the second bean.
>
> But it seems like unless I start using some scriplets, I cant test a bean
> property to another bean property.
>
> And yes, I have RTFM, unfortunately I cant seem to find it in there. It
> seems that they've really changed the docs for the Struts taglib. I liked
> the old style too. Too bad now you have to dig through several links to
get
> to the old doc style.
>
> -Tim
>
>
>



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

Reply via email to