• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Struts LinkedHashMap list request scope  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have an issue in struts 1.3,  getting data from database in the form of key , value pair , key is an Integer and value is a customer object,  able to display using logic iterate tag,

ActionForm having setter and getters of type LinkedHashMap (Integer, customer)
Scope of actionform request

Problem is when I submit request  lossing LinkedHashMap object data,  how to retain data in  action form  
Posts: 9551
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts 1.x is past end of life and is unsupported.  If it is at all possible, upgrade to the latest version of Struts 2 or another framework.
If you want to persist a collection to a JSP and recover it later, you have to use indexed properties.  If you aren't displaying the properties on the page, it may be easier to put the value in the session.
Chakravathy Rajan
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am trying similar to the example given in indexed properties. able to successfully retain data using indexed properties  if i keep data in list.
but for LinkedHashMap if i got any example its very help ful.

how to declare in form and  how to iterate in jsp.

my code in form written like below
private LinkedHashMap<Integer,Customer> simTypeMaPlist;

public LinkedHashMap<Integer, Customer> getSimTypeMaPlist() {
return simTypeMaPlist;
public void setSimTypeMaPlist(
LinkedHashMap<Integer, Customer> simTypeMaPlist) {
this.simTypeMaPlist = simTypeMaPlist;

public Customer getSimMapItem( int key ) {
       if (this.simTypeMaPlist == null) {
           this.simTypeMaPlist = new LinkedHashMap<Integer, Customer>();
       while (!(this.simTypeMaPlist.containsKey(key))) {
           this.simTypeMaPlist.put( key,new IndividualContact() );
       return (Customer) this.simTypeMaPlist.get( key );

<logic:iterate id="simItem1" name="SampleForm" property="simTypeMaPlist"  indexId="idx">
<html:hidden name="simItem1" property ="key" indexed="true"/>
<html:hidden name="simItem1" property ="value" indexed="true"/>
            <bean:write name="simItem1" property="value.firstName"/>
<bean:write name="simItem1" property="key"/>

please correct  , so that i can retain values when i form submit.

All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!