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
16
17
18
19
20 public class PreviewEntryAction extends CurationAction {
21
22
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
32 String previewFrom = mapping.getPath().substring(8);
33
34 request.getSession().setAttribute("previewFrom", previewFrom.substring(0, 1).toLowerCase() + previewFrom.substring(1));
35 return mapping.findForward(INTENZ_ENTRY_PREVIEW_JSP_FWD);
36 }
37 }