You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Arik Levin ( Tikal )" <ar...@businesslayers.co.il> on 2003/02/16 11:01:50 UTC
Struts to JSTL EL - Taglib 1.0 implementation
Hi all.
I'm new at JSTL, I hope someone can help me here.
I have struts bean:define which looks like this:
<bean:define name="UIManager" property="collection(tab)" />
UIManager bean has getCollection(String) property.
What is the equivalent syntax for JSTL? I'm using Jakarta Taglib
1.0 implementation.
Thanx.
Re: Struts to JSTL EL - Taglib 1.0 implementation
Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Arik" == Arik Levin <Arik> writes:
Arik> Hi all.
Arik> I'm new at JSTL, I hope someone can help me here.
Arik> I have struts bean:define which looks like this:
Arik> <bean:define name="UIManager" property="collection(tab)" />
Arik> UIManager bean has getCollection(String) property.
Arik> What is the equivalent syntax for JSTL? I'm using Jakarta Taglib
Arik> 1.0 implementation.
As you pointed out in another response, the JSTL (and JavaBeans) doesn't
support getters with parameters.
If you're just using the JSTL, and not using Struts or Struts-EL, then you'll
need to load this data in the "Model" part of your "Web MVC"-based application
(the "Action" class in a Struts-based application). If you're using Struts and
Struts-EL, then you could just continue to use "bean:define" from the Struts
library, and use Struts-EL for everything else (as you've discovered the
"bean:define" tag wasn't implemented in Struts-EL). If you just want to use
Struts-EL, then load the data in your Action class.
--
===================================================================
David M. Karr ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net ; SCJP; SCWCD
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Struts to JSTL EL - Taglib 1.0 implementation
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sun, 16 Feb 2003, Arik Levin ( Tikal ) wrote:
> Date: Sun, 16 Feb 2003 12:01:50 +0200
> From: "Arik Levin ( Tikal )" <ar...@businesslayers.co.il>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: Struts to JSTL EL - Taglib 1.0 implementation
>
> Hi all.
>
> I'm new at JSTL, I hope someone can help me here.
>
> I have struts bean:define which looks like this:
> <bean:define name="UIManager" property="collection(tab)" />
>
> UIManager bean has getCollection(String) property.
>
Although the JavaBeans spec doesn't really define anything like what
BeanUtils calls "mapped" properties, so JSTL doesn't support them either.
However, the expression language does have special support for maps, so if
you could change your:
public MyObject getCollection(String key);
into something like:
public Map getCollectionMap();
Then you could replace:
<bean:define id="foo" name="UIManager" property="collection(bar)"/>
with either of:
<c:set var="foo" value="${UIManager.collectionMap[bar]}"/>
<c:set var="foo" value="${UIManager.collectionMap.bar}"/>
> What is the equivalent syntax for JSTL? I'm using Jakarta Taglib
> 1.0 implementation.
>
> Thanx.
>
>
>
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org