aspose file tools*
The moose likes Struts and the fly likes How to submit a form like this, using struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to submit a form like this, using struts?" Watch "How to submit a form like this, using struts?" New topic
Author

How to submit a form like this, using struts?

jaman tai
Ranch Hand

Joined: Sep 26, 2005
Posts: 37
I have a form having 3 buttons. One is �Approve�, one is �Reject� and one is �Back�. If click Approve, update db directly and back. If click �Reject�, pup up a small window to ask the reject reason. (I am using javascript�s windows.open) after input the reason and click �go�, close the small window, update db and the original page goes back. If click �Back�, go back directly. How can I design this page? I know a little about LookupDispatchAction. Can anybody help me? Thanks a lot!
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Moving to the Struts forum...


A good workman is known by his tools.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
For this, I'd use DispatchAction rather than LookupDispatchAction. The main reason for using LookupDispatchAction over DispatchAction is that it allows you to avoid using JavaScript. Since you have to pop up a window, you have to use JavaScript anyway.

Here's what I'd do:

1-Code an Action extending DispatchAction with accept() reject() and back() methods.
2-Put a hidden field in your JSP named "actionCode" with a corresponding property in your ActionForm.
3-Specify parameter="actionCode" when you define the action path.
4-When any of the buttons are pressed, use JavaScript to change the value of actionCode appropriately and submit the form.
5-In the case of a reject, code a hidden field named "rejectReason" in your main JSP. When the user presses the reject button, pop up the window. When the user presses go on the popup window, use JavaScript to populate the rejectReason field, change the actionCode appropriately, submit the form, and close the popup window.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to submit a form like this, using struts?
 
Similar Threads
Java & Outlook integration - how to go about it
How to submit a form in struts like this?
regarding refreshing the parent window
Edit Box in JSF
Check if popup window is already open from parent window?