Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do we always need form element to invoke action class?

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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
    • Quote
    • Report post to moderator
    thnx. I am planning to take the second way.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic