source: ether_megapoli/trunk/service/implementation/com/medias/megapoli/struts/actions/DescCapteurAction.java @ 151

Last change on this file since 151 was 151, checked in by vmipsl, 13 years ago

Import medias files and cleanup

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1/*
2 * Created on 3 mai 2005
3 */
4package com.medias.megapoli.struts.actions;
5
6import javax.servlet.ServletException;
7import javax.servlet.http.*;
8
9import org.apache.struts.action.*;
10import com.medias.megapoli.struts.forms.CapteurForm;
11import com.medias.megapoli.trade.CapteurAdapter;
12
13
14/**
15 * @author pignot
16 *
17 * Action déclenchée au moment d'afficher la description d'un capteur
18 */
19public class DescCapteurAction extends Action {
20   
21    public ActionForward execute (ActionMapping mapping, 
22                                  ActionForm form,
23                                  HttpServletRequest request, 
24                                  HttpServletResponse response)
25            throws ServletException {
26       
27        CapteurAdapter adapter = new CapteurAdapter ();
28        String target = "failure";
29        ActionErrors errors = new ActionErrors ();
30
31        if (form != null) {
32            CapteurForm cform = (CapteurForm)form;
33            String id = request.getParameter ("idCapt");
34            try {
35                // A partir de la base de données ...
36                adapter.loadCapteurFromDatabase (cform, id);
37                target = "success";
38            } catch (Exception e) {
39                System.out.println ("exception_DescCapteurAction");
40                errors.add (ActionErrors.GLOBAL_MESSAGE, 
41                            new ActionError ("errors.access.requete.fail"));
42                e.printStackTrace ();
43            }
44        }
45        if (!errors.isEmpty ()) {
46            saveErrors (request, errors);
47        }
48       
49        return mapping.findForward (target);
50       
51    }
52   
53}
Note: See TracBrowser for help on using the repository browser.