struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "rama chandrula" <rchandr...@hotmail.com>
Subject Re: directly addressing maps in jsp-file
Date Mon, 17 Apr 2006 07:18:43 GMT

Hi Vinit,

I have used jstl to display the data in the form. But if I want to edit this 
data and send them back to the action form. I am not able to do this. can u 
give me a suggestion how I can proceed further

Thanks,
Rama

>From: "Vinit Sharma" <vinit4j@gmail.com>
>Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
>To: "Struts Users Mailing List" <user@struts.apache.org>
>Subject: Re: directly addressing maps in jsp-file
>Date: Thu, 13 Apr 2006 11:04:49 +0530
>
>Hi,
>
>JSTL can help you here. Suppose key comes from bean item:
>
><c:set var="key" value="${item.fieldName}"/>
>
>I can use this key to access the bean property as:
>
><c:out value='${hasht[key]}'/>
>
>Hope it works :)
>
>HTH,
>
>
>On 4/12/06, Andreas Hartmann <andihartmann@freenet.de> wrote:
> >
> > Hello all,
> >
> > I've got some problems accessing arrays and maps in the jsp-file.
> >
> > In the Action class, the following objects are defined:
> >
> > Hashtable <String,String> hash = new Hashtable<String,String>();
> > ArrayList <Hashtable <String,String>> list = new ArrayList <Hashtable
> > <String,String>>();
> >
> > hash.put("key","value");
> > hash.put("key1","value1");
> >
> > list.add(hash);
> >
> > rq.setAttribute("hasht", hash)
> > rq.setAttribute("array", list);
> >
> >
> >
> > In the jsp-file:
> >
> > Access with iterate through Arraylist:
> > <logic:iterate name="array" id="hashtable" >
> >         <bean:write name="hashtable" property="key"/>
> > </logic:iterate>
> >
> >
> >
> > direct access of the value with the key in the hashtable:
> > <bean:write name="hasht" property="key - don't know">
> >
> > The key could come from an method (Something like some_other_list.get(1)
> > e.g.) or a literal like key1 as defined in the example above.
> >
> >
> > I would be very glad, if anybody could solve my problem with directly
> > accessing Hashtables in jsp-file.
> >
> >
> > Kind regards,
> > Andreas Hartmann
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>--
>Vinit Sharma
>IBM

_________________________________________________________________
One and only Ash. Find out all about her. Only on MSN Search 
http://server1.msn.co.in/profile/aishwarya.asp


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


Mime
View raw message