You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steve Salkin <ss...@NetVendor.com> on 2001/06/05 23:08:43 UTC
testing for a nested bean value
Hi-
Say you have a bean in the request that is being processed by the jsp, call
it
resultBean. In this bean you have a bean called multimediaBean, and this
bean has
a property called url.
So, I think I should be able to say
<img src="<bean:write name="resultBean" property="multimediaBean.url"/>" >
But if the multimediaBean is null this dies out.
So, I think I should be able to protect this with a logic:present as
follows:
<logic:present name="resultBean" property="multimediaBean.url>
<img src="<bean:write name="resultBean" property="multimediaBean.url"/>" >
</logic:present>
But this also dies. So I think this must be because the multimediaBean call
returning
null in the logic:present tag is not being checked, and so I nest them:
<logic:present name="resultBean" property="multimediaBean>
<logic:present name="resultBean" property="multimediaBean.url>
<img src="<bean:write name="resultBean" property="multimediaBean.url"/>"
>
</logic:present>
</logic:present>
and this too fails.
Any tips on how to handle this one?
Thanks in advance,
S-