Exactly right on.
-----Original Message-----
From: Bartley, Chris P [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 6:42 PM
To: '[EMAIL PROTECTED]'
Subject: RE: bean:write returning null
> Couln't you use the ignore=true flag instead?
Well, it depends. I guess i assumed Mark didn't want to just ignore
it...maybe his JSP has something like:
<p>Bubba says "<bean:write name="foo" property="bar" ignore="true"/>"</p>
In which case, the rendered HTML would be:
<p>Bubba says ""</p>
...which would look weird. So maybe he'd just rather not write the "Bubba
says" message at all in that case, which is why i wrote the example in my
previous post the way i did. So, he could do:
<bean:define id="bubba" name="foo" property="bar"/>
<logic:present name="bubba">
<p>Bubba says "<bean:write name="bubba"/>"</p>
</logic:present>
But, i guess this would be even better:
<logic:present name="foo" property="bar">
<p>Bubba says "<bean:write name="foo" property="bar"/>"</p>
</logic:present>
Time to go home...yay for Friday.
thanks,
chris
> -----Original Message-----
> From: Pedone, Tim [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 10, 2002 5:12 PM
> To: 'Struts Users Mailing List'
> Subject: RE: bean:write returning null
>
>
> Couln't you use the ignore=true flag instead?
>
> <bean:define id="bubba" name="foo" property="bar"/>
> <bean:write name="bubba" ignore="true"/>
>
> If bubba were null, nothing would get written.
>
> You could take this one step further if you were simply
> checking the bean
> itself and not a property of the bean for null:
>
> <bean:write name="bubba" ignore="true"/>
>
> would ignore if the "bubba" bean could not be found in any
> scope. If you
> using a property of bubba that could be null...
>
> <bean:write name="bubba" property="bubbaProp" ignore="true"/>
>
> would write nothing if bubba was null but wouldn't if
> bubba.getBubbaProp()
> returned null, then you'd have to use the bean:define version above.
>
> Tim
>
> -----Original Message-----
> From: Bartley, Chris P [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 10, 2002 1:56 PM
> To: 'Struts Users Mailing List'
> Subject: RE: bean:write returning null
>
>
> Have you tried doing a <bean:define> first, and then checking
> for null with
> <logic:present>?
>
> For example, say that you were doing this:
>
> <bean:write name="foo" property="bar"/>
>
> But you want to make sure that it isn't null first...so, try this:
>
> <bean:define id="bubba" name="foo" property="bar"/>
> <logic:present name="bubba">
> <bean:write name="bubba"/>
> </logic:present>
>
> (i haven't tested this, so my apologies for any syntax errors)
>
> Hope that helps.
>
> chris
>
> > -----Original Message-----
> > From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 10, 2002 3:37 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: bean:write returning null
> >
> >
> > I tried logic:isEmpty without success.
> >
> > -----Original Message-----
> > From: Thinh Doan [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 10, 2002 4:44 PM
> > To: Struts Users Mailing List
> > Subject: RE: bean:write returning null
> >
> >
> > Can you use logic:present ?
> >
> > Thinh
> >
> > -----Original Message-----
> > From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 10, 2002 3:30 PM
> > To: Struts (E-mail)
> > Subject: bean:write returning null
> >
> >
> > How are you guys testing for this in JSP?
> >
> > Mark
> > "De recta non tolerandum sunt."
> >
> >
> > --
> > 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]>
> >
>
> --
> 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]>
--
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]>