You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gupta, Karan" <ka...@transcore.com> on 2006/01/14 01:32:30 UTC

How to use a tag withing another tag?

Hi,

I'm using a logic:equal tag in my jsp and the value of the property has to be compared with the value in a bean. How is it possible to do that?
 
In the following code, both "inventoryDefinitions" and "equipTypes" are of type List.
<logic:iterate id="iDefObj" name="IDefForm" property="inventoryDefinitions">
	<logic:iterate id="equipTypeObj" name="IDefForm" property="equipTypes">
		<logic:equal name="iDefObj" property="equipType" value="equipTypeObj.equipType"> 
			<bean:write name="equipTypeObj" property="equipTypeDesc"/>
		</logic:equal>
	</logic:iterate>
</logic:iterate>

I have tried several ways, including 
<logic:equal name="iDefObj" property="equipType" 
	value="<bean:write name='equipTypeObj' property='equipType'/>"> 
but nothing seems to work.

Thanks,
Karan 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to use a tag withing another tag?

Posted by Wendy Smoak <ws...@gmail.com>.
On 1/13/06, Gupta, Karan <ka...@transcore.com> wrote:

> I have tried several ways, including
> <logic:equal name="iDefObj" property="equipType"
>         value="<bean:write name='equipTypeObj' property='equipType'/>">
> but nothing seems to work.

As you've discovered, you can't use a JSP tag as an attribute of
another JSP tag.

You can use JSTL:
   value="${equipTypeObj.equipType}"

Whether that will "just work" depends on your environment and configuration.

When asking questions, please tell us what version of Struts you're
using, and whether you're on Servlet 2.2, 2.3 or 2.4.  (Or tell us
what version of what Servlet container you're using.)  Especially in
this case, it makes a difference in the answer.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to use a tag withing another tag?

Posted by Michael Jouravlev <jm...@gmail.com>.
You cannot use tag inside another tag. In most cases you can use
element content instead of "value" attribute of that element.

Michael.

On 1/13/06, Gupta, Karan <ka...@transcore.com> wrote:
> Hi,
>
> I'm using a logic:equal tag in my jsp and the value of the property has to be compared with the value in a bean. How is it possible to do that?
>
> In the following code, both "inventoryDefinitions" and "equipTypes" are of type List.
> <logic:iterate id="iDefObj" name="IDefForm" property="inventoryDefinitions">
>         <logic:iterate id="equipTypeObj" name="IDefForm" property="equipTypes">
>                 <logic:equal name="iDefObj" property="equipType" value="equipTypeObj.equipType">
>                         <bean:write name="equipTypeObj" property="equipTypeDesc"/>
>                 </logic:equal>
>         </logic:iterate>
> </logic:iterate>
>
> I have tried several ways, including
> <logic:equal name="iDefObj" property="equipType"
>         value="<bean:write name='equipTypeObj' property='equipType'/>">
> but nothing seems to work.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org