This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Multiple Action Class for single form bean and single JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple Action Class for single form bean and single JSP" Watch "Multiple Action Class for single form bean and single JSP" New topic
Author

Multiple Action Class for single form bean and single JSP

Satyajit Bhadange
Ranch Hand

Joined: May 13, 2010
Posts: 104
Hi,

I am working on Struts 1.3.
I have one doubt.

I am writing a single JSP and Single ActionForm but there are multiple Action classes(doing specific tasks).

I want to write JSP,want to know how to write


and also how to call different action on form submit.


Thanks
user101
Problems And Solutions - Algorithms
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

It is completely driven by struts-config in your case(since you have only 1 form and 1 JSP).
Firstly, to me i do not use the action class as a model part (debatable) instead i use it as controller (in case of earlier versions of Struts2). Just to minimize the number of action classes and struts mapping.

However you can achieve this in 2 ways
1. You can have more than one action mappings in struts-config with the same form. And while submitting the form from JS you can mention the URL corresponding to your action classes
2. On submit from JSP, you can always direction to one action class and from their based on requirement, conditionally forward it to other action classes.


Have Fun with Java
little,little.. little by little makes a lot..
 
 
subject: Multiple Action Class for single form bean and single JSP