Hi all, I've inherited a struts 1 web application where, in order to reduce the number of Action classes (I guess this is the reason), lots of actions are mapped inside a single Action class, like:
public XXXAction() throws Exception{
actions = new Hashtable();
actions.put("/XXX/main/load", new Integer(0));
actions.put("/XXX/main/save", new Integer(1));
......
}
public ActionForward executeAction(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
try
{
switch (((Integer) actions.get(action)).intValue())
{
case 0:
loadXXXMain();
break;
case 1:
.......
and so on (in some Action classes I have almost one hundred of these small actions).
Now I'm looking at migrate to struts2 and I would like to have a cleaner and better solution to handle this, maybe without having a single Action class for each of these small classes. What do you suggest? I don't like this solution, but I don't like having hundreds of Action classes....
Thanks! Roberto