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.PlateformesForm; |
---|
11 | import com.medias.megapoli.trade.ListePlateformesAdapter; |
---|
12 | |
---|
13 | /** |
---|
14 | * @author pignot |
---|
15 | * |
---|
16 | * Action déclenchée au moment d'afficher la liste des plateformes |
---|
17 | */ |
---|
18 | public class PlateformesAccessAction extends Action { |
---|
19 | public ActionForward execute(ActionMapping mapping, ActionForm form, |
---|
20 | HttpServletRequest request, HttpServletResponse response) |
---|
21 | throws ServletException { |
---|
22 | ListePlateformesAdapter adapter = new ListePlateformesAdapter(); |
---|
23 | String target = "failure"; |
---|
24 | ActionErrors errors = new ActionErrors(); |
---|
25 | if (form != null) { |
---|
26 | PlateformesForm pform = (PlateformesForm) form; |
---|
27 | try { |
---|
28 | // A partir de la base de données ... |
---|
29 | adapter.loadPlateformesFromDatabase(pform); |
---|
30 | target = "success"; |
---|
31 | } catch (Exception e) { |
---|
32 | System.out.println("exception_PlateformesAccessAction"); |
---|
33 | errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError( |
---|
34 | "errors.access.requete.fail")); |
---|
35 | e.printStackTrace(); |
---|
36 | } |
---|
37 | } |
---|
38 | if (!errors.isEmpty()) { |
---|
39 | saveErrors(request, errors); |
---|
40 | } |
---|
41 | return mapping.findForward(target); |
---|
42 | } |
---|
43 | } |
---|