wood burning stoves 2.0*
The moose likes Struts and the fly likes Multiple forms in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple forms in Struts" Watch "Multiple forms in Struts" New topic
Author

Multiple forms in Struts

Matthew Anderson
Greenhorn

Joined: Jul 03, 2007
Posts: 9
Hi,

I have a simple Struts app that's connected to a DB. I can search for an "employee" and now I want to add the functionality to add an employee, so I have two buttons in a JSP page. When I come to the Action/controller page, how can I know which button that has been pressed, i.e, which form that is populated? Can I set a variable in the JSP page, or what kind of info can I retrieve from the JSP page.

Thanks,
Mattias
rahul khanna
Ranch Hand

Joined: Sep 14, 2005
Posts: 48
Rather than having buttons If you can have two hyperlinks that would solve the issue as you can call different actions..

If you have two buttons ..I am not sure .. but try enclosing them in two different forms within the same jsp..
Matthew Anderson
Greenhorn

Joined: Jul 03, 2007
Posts: 9
I found this solution: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg24165.html

/Matt
[ July 04, 2007: Message edited by: Code Exception ]
Ranjit Gopinathan
Ranch Hand

Joined: Jul 03, 2007
Posts: 46
Why dont you have a look at LookUpDispatchAction or DispatchAction.

I believe, that will solve your problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple forms in Struts
 
Similar Threads
Employee Application developed in Struts
How to set a radio button selected from a JSP page, with the help of values extracted from database?
Struts handling multiple arraylists
iterating tables
How Struts will identify Class (with get / set methods) associated with it