Win a copy of Rust Web Development this week in the Other Languages 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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.
     
    WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic