commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Beer, Christian" <Christian.B...@Diron.DE>
Subject RE: [Jelly] Accessing a HashMap in JellyContext variables from sc ript
Date Mon, 29 Mar 2004 08:17:22 GMT
Hi David!

You've got the idea of jellys expression language (and also JSTL, if you
would use that) not right (some would say: RTFM ;) )! You can't call methods
in jelly and you don't have to!

Your script:
> <j:if test="${myBeanMap.get("aBean").success == true}">
>	<pass/>
> </j:if>

would be:
<j:if test="${myBeanMap.aBean.success == true}">
  <pass/>
</j:if>

or:
<j:if test="${myBeanMap['aBean'].success == true}">
  <pass/>
</j:if>

And because your success field is a boolean (you have a is... method for
that, don't you?) you could do:
<j:if test="${myBeanMap.aBean.success}">
  <pass/>
</j:if>


Greets,

Christian Beer
Projektleiter / Project Manager

diron GmbH & Co. KG
Daimlerweg 39-41
D-48163 Muenster, Germany
T +49-251-979 20 0
F +49-251-979 20 20
E christian.beer@diron.de
WWW < http://www.diron.de/ >

----------------------------------------------------------
       ---- NEWS ---- NEWS ---- NEWS ---- NEWS ----       
----------------------------------------------------------
Besuchen Sie uns auf der drupa 2004

       Düsseldorf 06.-19.05. 2004
            
              Dynamic Document Parc, Stand S11
----------------------------------------------------------
 

> -----Ursprüngliche Nachricht-----
> Von: David Wynter [mailto:david@roamware.co.uk] 
> Gesendet: Freitag, 26. März 2004 20:58
> An: Jakarta Commons Users List
> Betreff: RE: [Jelly] Accessing a HashMap in JellyContext 
> variables from script
> 
> 
> Hi,
> 
> Is my question too hard or too stupid? I note from the Jexl 
> code there is an 'is' method for Boolean that it look sfor, 
> not sure how this would affect my approach to testing a 
> Boolean, should I add an isSuccess() method to my bean?
> 
> Thanks
> 
> David
> 
> > -----Original Message-----
> > From: David Wynter [mailto:david@roamware.co.uk]
> > Sent: 25 March 2004 15:32
> > To: Jakarta Commons Users List
> > Subject: [Jelly] Accessing a HashMap in JellyContext variables from 
> > script
> >
> >
> > If I add a HashMap with JavaBeans in it into the 
> JellyContext like so:
> >
> > 			HashMap myBeanMap = new HashMap();
> > 			MyBean aBean = new MyBean();
> > 			aBean.setSuccess(new Boolean(true));
> > 			myBeanMap.put("aBean", aBean);
> > 			JellyContext myContext = this.getContext();
> > 			myContext.setVariable("myBeanMap", myBeanMap);
> >
> > How would I then test that for that value in HashMap in a Jexl 
> > expression?
> >
> > something like this?
> > <j:if test="${myBeanMap.get("aBean").success == true}">
> > 	<pass/>
> > </j:if>
> >
> > Thanks
> >
> > David
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> commons-user-help@jakarta.apache.org
> >
> 
> 

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


Mime
View raw message