source: ether_megapoli/trunk/service/implementation/com/medias/megapoli/struts/actions/PrepareFileListAction.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.5 KB
Line 
1package com.medias.megapoli.struts.actions;
2
3import javax.servlet.ServletException;
4import javax.servlet.http.HttpServletRequest;
5import javax.servlet.http.HttpServletResponse;
6
7import org.apache.struts.action.Action;
8import org.apache.struts.action.ActionForm;
9import org.apache.struts.action.ActionForward;
10import org.apache.struts.action.ActionMapping;
11import com.medias.xml.hierarchie.Hierarchie;
12import org.apache.struts.action.ActionError;
13import org.apache.struts.action.ActionErrors;
14
15
16/**
17 * @author combaz
18 *
19 * Created on 22 févr. 2005
20 */
21public class PrepareFileListAction extends Action {
22        public ActionForward execute(ActionMapping mapping,ActionForm form,
23                        HttpServletRequest request, HttpServletResponse response)
24                throws ServletException {
25                String target = "failure";
26                ActionErrors errors = new ActionErrors();
27               
28                Hierarchie tree = (Hierarchie) request.getSession().getServletContext().getAttribute("APP_UPLOADTREE");
29                String path = (String) request.getParameter("setPath");
30                try{
31                        tree.createFileView(path);
32                        request.getSession().setAttribute("jeu",path.substring(path.lastIndexOf("/")+1));
33                        request.getSession().setAttribute("categ",path.substring(0,path.indexOf("/")));
34                        target = "success";
35                }
36                catch(Exception e) {
37                        System.out.println ("exception_prepareFileListAction");
38                        errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("errors.upload.prepareFileList.failed"));
39                        e.printStackTrace();
40                }       
41               
42                if(!errors.isEmpty()){
43                        saveErrors(request, errors);
44                }
45               
46                return (mapping.findForward(target));
47        }
48}
Note: See TracBrowser for help on using the repository browser.