1 | /* |
---|
2 | * Created on 3 mai 2005 |
---|
3 | */ |
---|
4 | package com.medias.megapoli.struts.actions; |
---|
5 | |
---|
6 | import javax.servlet.ServletException; |
---|
7 | import javax.servlet.http.*; |
---|
8 | |
---|
9 | import org.apache.struts.action.*; |
---|
10 | import com.medias.megapoli.struts.forms.ParametreForm; |
---|
11 | import com.medias.megapoli.trade.ParametreAdapter; |
---|
12 | |
---|
13 | /** |
---|
14 | * @author pignot |
---|
15 | * |
---|
16 | * Action déclenchée au moment d'afficher la description d'un paramÚtre |
---|
17 | */ |
---|
18 | public class DescParametreAction extends Action { |
---|
19 | public ActionForward execute(ActionMapping mapping, ActionForm form, |
---|
20 | HttpServletRequest request, HttpServletResponse response) |
---|
21 | throws ServletException { |
---|
22 | ParametreAdapter adapter = new ParametreAdapter(); |
---|
23 | String target = "failure"; |
---|
24 | ActionErrors errors = new ActionErrors(); |
---|
25 | |
---|
26 | if (form != null) { |
---|
27 | ParametreForm pform = (ParametreForm) form; |
---|
28 | String id = request.getParameter("idParam"); |
---|
29 | try { |
---|
30 | // A partir de la base de données ... |
---|
31 | adapter.loadParametreFromDatabase(pform, id); |
---|
32 | target = "success"; |
---|
33 | } catch (Exception e) { |
---|
34 | System.out.println("exception_DescParametreAction"); |
---|
35 | errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError( |
---|
36 | "errors.access.requete.fail")); |
---|
37 | e.printStackTrace(); |
---|
38 | } |
---|
39 | } |
---|
40 | if (!errors.isEmpty()) { |
---|
41 | saveErrors(request, errors); |
---|
42 | } |
---|
43 | return mapping.findForward(target); |
---|
44 | } |
---|
45 | } |
---|