Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Struts LinkedHashMap list request scope

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: 9583
Mac OS X Linux 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.

When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!