• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Strus 1.1: Dropdown select with reset and multi-page form in session

Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Struts 1.1. I have a multi-page form (4 pages) and i am configuring my form in the session(struts-config.xml). These 4 pages handle the functionality for add operation as well as modification. I have drop down (multiple select) on all the 4 pages. Final database addition/ modification takes place on the submit of the 4th page. The add data operation works fine, but modification operation has issues.

e.g. during the modify scenario, i am first retrieving the data corresponding to a unique record from the database and displaying it on the 4 pages. Issue arises when any select box (drop down) has some values at first (as retrieved from database) and then i deselect all of them, such that i send an empty drop down box.. But when i check the database, those deselected values still persist in the database. This is because the formbean (in session) still contains the old values and thus get saved in the database.

I tried setting the select boxes to null in the reset method (based on the page numbers saved on the session formbean - hidden page number on each of the 4 pages), but this approach fails whenever there is a validation error. Here, on validation errors, when control comes back to the input page, either the drop down value is empty or when i click submit on the 4th page, the select drop down value of the 1st page, 2nd page and 3rd page gets set to null (due to them being set to null in the reset method) and thus, i lose the select drop down values of the previous pages and am faced with NullPointer exception.

Could anyone provide some help on how to implement this ?? (i.e during modify scenario, my old values should be replaced by either new values or empty as set by the user considering that select dropdowns are present on each of the 4 pages and database update occurs on the final submit of the 4th page).

Any help would be greatly appreciated.
Thanks in advance.
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic