• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Multiple forms - one jsp

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having a dilemma on how to handle two forms on one jsp page. The first form is basically a header with a drop down list in it. I have a form bean and an action mapping for that. The second form is a display of users from the database again with its own form bean and action mapping. Ultimately if the user changes the information on the drop down list the report under it will change as well, but I am not sure how I can get the data from the drop down list into the second form.

If I try to retrieve anything in the second action form that has to do with the first then I get a null pointer exception.

Do I need to set something up in my struts-config.xml that allows them to talk to each other or do I need to do something totally different?

Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using your action class to extend LookupDispatchAction instead of action, this class is made for multiple submit buttons. You can have one big form with two different submit buttons, it will call your class and jump to the appropriate execute method depending on which submit button was clicked. Sounds a little tricky but the struts API shows you exactly what you need to have in your action class to set this up, it's really quite easy
Maybe he went home and went to bed. And took this tiny ad with him:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic