1 23 24 package org.infoglue.cms.workflow.taglib; 25 26 import java.text.MessageFormat ; 27 28 import javax.servlet.jsp.JspException ; 29 30 35 public class FormTag extends WorkflowTag 36 { 37 40 private static final long serialVersionUID = -558848421886366918L; 41 42 45 private static final String ACTION_ADDRESS_PARAMETER = "returnAddress"; 46 47 50 private static final String FINISHED_ADDRESS_PARAMETER = "finalReturnAddress"; 51 52 55 private static final String FORM_START = "<form name=\"form\" id=\"form\" method=\"post\" action=\"{0}\">"; 56 57 60 private static final String HIDDEN = "<div><input id=\"{0}\" name=\"{0}\" type=\"hidden\" value=\"{1}\"/></div>"; 61 62 65 private static final String FORM_END = "</form>"; 66 67 70 public FormTag() 71 { 72 super(); 73 } 74 75 82 public int doStartTag() throws JspException 83 { 84 write(MessageFormat.format(FORM_START, new Object [] { getActionAddress() })); 85 write(MessageFormat.format(HIDDEN, new Object [] { ACTION_ID_PARAMETER, getActionID() })); 86 write(MessageFormat.format(HIDDEN, new Object [] { FINISHED_ADDRESS_PARAMETER, getFinalReturnAddress() })); 87 write(MessageFormat.format(HIDDEN, new Object [] { WORKFLOW_ID_PARAMETER, getWorkflowID() })); 88 return EVAL_BODY_INCLUDE; 89 } 90 91 97 public int doEndTag() throws JspException 98 { 99 write(FORM_END); 100 return EVAL_PAGE; 101 } 102 103 108 private String getActionAddress() 109 { 110 return pageContext.getRequest().getParameter(ACTION_ADDRESS_PARAMETER); 111 } 112 113 118 private String getFinalReturnAddress() 119 { 120 return pageContext.getRequest().getParameter(FINISHED_ADDRESS_PARAMETER); 121 } 122 123 } 124 | Popular Tags |