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.FichiersForm; |
---|
11 | import com.medias.megapoli.trade.ListeFichiersAdapter; |
---|
12 | |
---|
13 | /** |
---|
14 | * @author pignot |
---|
15 | * |
---|
16 | * Action déclenchée au moment d'afficher la liste des fichiers d'un jeu |
---|
17 | */ |
---|
18 | public class FichiersAccessAction extends Action { |
---|
19 | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) |
---|
20 | throws ServletException { |
---|
21 | ListeFichiersAdapter adapter = new ListeFichiersAdapter(); |
---|
22 | int idJeu = Integer.parseInt(request.getParameter("idJeu")); |
---|
23 | String target = "failure"; |
---|
24 | ActionErrors errors = new ActionErrors(); |
---|
25 | if (form != null) { |
---|
26 | FichiersForm fform = (FichiersForm) form; |
---|
27 | fform.setIdJeu(idJeu); |
---|
28 | try { |
---|
29 | // A partir de la base de données ... |
---|
30 | adapter.loadFichiersFromDatabase(fform, idJeu); |
---|
31 | target = "success"; |
---|
32 | } catch (Exception e) { |
---|
33 | System.out.println("exception_FichiersAccessAction"); |
---|
34 | errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("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 | } |
---|