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

Do we always need form element to invoke action class?

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do we always need form element to invoke action class?

For Eg.

I have a ADD screen . On pressing submit. I generate a ConfirmScreen with data enetered entered by the user in the ADD screen.

The ConfirmScreen has a OK and Cacel button. Only if the user presses ok the data has to be submitted to the database.

In my second screen I don't have any form element. Lots of Bean:write tag and a html submit and reset button. how do I call the Action class in this case?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use an action in an <html:form> tag, it must have an ActionForm associated with it. There is no getting around this rule.

In your specific situation, I see two differnt ways you could go:
  • In your confirmation screen, embed all the data in <html:hidden> fields that correspond to the data being displayed with <bean:write> tags. Then just make the "OK" button a submit button, and the form will be submitted with the data
  • Make the confirm screen just a pop-up screen with no form in it at all. If the user presses cancel, just close the window. If she presses "OK", use JavaScript to submit the form in the parent window (opener.document.forms[0].submit()).

  •  
    shah rah
    Ranch Hand
    Posts: 124
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    thnx. I am planning to take the second way.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic