1 | /* |
---|
2 | * Created on 3 mai 2005 |
---|
3 | */ |
---|
4 | package com.medias.megapoli.struts.actions; |
---|
5 | |
---|
6 | |
---|
7 | import javax.servlet.ServletException; |
---|
8 | import javax.servlet.http.*; |
---|
9 | |
---|
10 | import org.apache.struts.action.*; |
---|
11 | import com.medias.megapoli.struts.forms.DatasForm; |
---|
12 | import com.medias.megapoli.trade.ValeurAdapter; |
---|
13 | |
---|
14 | /** |
---|
15 | * @author pignot |
---|
16 | * |
---|
17 | * Action déclenchée au moment de valider les choix avant extraction |
---|
18 | */ |
---|
19 | public class DataSubmitAction extends Action { |
---|
20 | public ActionForward execute(ActionMapping mapping, ActionForm form, |
---|
21 | HttpServletRequest request, HttpServletResponse response) |
---|
22 | throws ServletException { |
---|
23 | String target = "success"; |
---|
24 | if (this.isCancelled(request)) { |
---|
25 | target = "cancel"; |
---|
26 | return mapping.findForward(target); |
---|
27 | } |
---|
28 | |
---|
29 | ActionErrors errors = new ActionErrors(); |
---|
30 | if (form != null) { |
---|
31 | DatasForm dform = (DatasForm) form; |
---|
32 | ValeurAdapter vAdapter = new ValeurAdapter(); |
---|
33 | vAdapter.loadCountFromDatabase(dform); |
---|
34 | dform.setListeCoords(dform.getLatMin()+","+dform.getLatMax()+","+dform.getLonMin()+","+dform.getLonMax()); |
---|
35 | dform.setListeDates(dform.getDateDeb()+","+dform.getDateFin()); |
---|
36 | } |
---|
37 | if (!errors.isEmpty()) { |
---|
38 | saveErrors(request, errors); |
---|
39 | } |
---|
40 | return mapping.findForward(target); |
---|
41 | } |
---|
42 | } |
---|