Bonjour !

Est-il possible de faire une action du genre :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
public class MonAction extends Action {
 
public ActionForward execute(
	ActionMapping mapping,
	ActionForm form,
	HttpServletRequest request,
	HttpServletResponse response)
	throws IOException, ServletException {
 
                HttpSession session = request.getSession(false);
	ActionForward forward = new ActionForward();
	MonForm monForm = (MonForm) form;
 	String id = monForm.getId();
 
	try {
	  switch(type) {
	    case 'A' :
	      // actions a faire
	    break;
	    case 'B' :
	     // actions a faire
	    break;
	    default;
	}
	  session.setAttribute("id",id);
	  forward.setPath("/autreAction.do?id="+id); 
	} catch (Exception ex) {
	    ex.printStackTrace();
	    System.out.println("pb");
	     forward = mapping.findForward("failure");
	}
	     return (forward);
    }
}
En fait je voudrais ne pas utiliser de DispatchAtion car seuls peu d'éléments diffèrent.
Si ce switch est possible, comment passer le parametre "type" a l'action ?

Merci !