View Javadoc

1   package uk.ac.ebi.intenz.webapp.controller.common;
2   
3   import javax.servlet.http.HttpServletRequest;
4   import javax.servlet.http.HttpServletResponse;
5   
6   import org.apache.struts.action.ActionForm;
7   import org.apache.struts.action.ActionForward;
8   import org.apache.struts.action.ActionMapping;
9   import org.apache.struts.taglib.html.Constants;
10  
11  import uk.ac.ebi.intenz.webapp.controller.modification.CurationAction;
12  import uk.ac.ebi.intenz.webapp.dtos.EnzymeDTO;
13  
14  /**
15   * This Action ...
16   *
17   * @author Michael Darsow
18   * @version $Revision: 1.2 $ $Date: 2008/01/28 12:33:13 $
19   */
20  public class PreviewEntryAction extends CurationAction {
21  
22  //  private static final Logger LOGGER = Logger.getLogger(PreviewEntryAction.class);
23    private static final String INTENZ_ENTRY_PREVIEW_JSP_FWD = "intenz_entry_preview";
24  
25    public ActionForward execute(ActionMapping mapping,
26                                 ActionForm form,
27                                 HttpServletRequest request,
28                                 HttpServletResponse response) throws Exception {
29       request.setAttribute("title", "Preview entry " + ((EnzymeDTO) request.getSession().getAttribute("enzymeDTO")).getEc() + " - IntEnz Curator Application");
30       request.setAttribute(Constants.TOKEN_KEY, request.getParameter(Constants.TOKEN_KEY));
31       // Get rid of "/preview":
32       String previewFrom = mapping.getPath().substring(8);
33        // Put on the request the action to be taken afterwards:
34        request.getSession().setAttribute("previewFrom", previewFrom.substring(0, 1).toLowerCase() + previewFrom.substring(1));
35      return mapping.findForward(INTENZ_ENTRY_PREVIEW_JSP_FWD);
36    }
37  }