[569] | 1 | package com.medias.megapoli.struts.actions; |
---|
| 2 | |
---|
| 3 | import javax.servlet.ServletException; |
---|
| 4 | import javax.servlet.http.HttpServletRequest; |
---|
| 5 | import javax.servlet.http.HttpServletResponse; |
---|
| 6 | |
---|
| 7 | import org.apache.struts.action.Action; |
---|
| 8 | import org.apache.struts.action.ActionForm; |
---|
| 9 | import org.apache.struts.action.ActionForward; |
---|
| 10 | import org.apache.struts.action.ActionMapping; |
---|
| 11 | import com.medias.xml.hierarchie.Hierarchie; |
---|
| 12 | import org.apache.struts.action.ActionError; |
---|
| 13 | import org.apache.struts.action.ActionErrors; |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | /** |
---|
| 17 | * @author combaz |
---|
| 18 | * |
---|
| 19 | * Created on 22 févr. 2005 |
---|
| 20 | */ |
---|
| 21 | public 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 | } |
---|