1 5 11 package com.opensymphony.webwork.views.jsp; 12 13 import com.opensymphony.webwork.components.URL; 14 import org.apache.commons.logging.Log; 15 import org.apache.commons.logging.LogFactory; 16 17 import javax.servlet.http.HttpServletRequest ; 18 import javax.servlet.http.HttpServletResponse ; 19 import javax.servlet.jsp.JspException ; 20 21 22 31 public class URLTag extends ParametereizedBodyTagSupport { 32 protected URL url; 33 34 protected String includeParams; 35 protected String scheme; 36 protected String value; 37 protected String encode; 38 protected String includeContext; 39 40 public int doEndTag() throws JspException { 41 url.addAllParameters(getParameters()); 42 url.end(pageContext.getOut()); 43 44 return EVAL_PAGE; 45 } 46 47 public int doStartTag() throws JspException { 48 url = new URL(getStack(), 49 (HttpServletRequest ) pageContext.getRequest(), 50 (HttpServletResponse ) pageContext.getResponse()); 51 url.setIncludeParams(includeParams); 52 url.setScheme(scheme); 53 url.setValue(value); 54 if (encode != null) { 55 url.setEncode(Boolean.valueOf(encode).booleanValue()); 56 } 57 if (includeContext != null) { 58 url.setIncludeContext(Boolean.valueOf(includeContext).booleanValue()); 59 } 60 url.start(pageContext.getOut()); 61 62 return EVAL_BODY_BUFFERED; 63 } 64 65 public void setEncode(String encode) { 66 this.encode = encode; 67 } 68 69 public void setIncludeContext(String includeContext) { 70 this.includeContext = includeContext; 71 } 72 73 public void setIncludeParams(String aName) { 74 includeParams = aName; 75 } 76 77 public void setScheme(String aScheme) { 78 scheme = aScheme; 79 } 80 81 public void setValue(String aName) { 82 value = aName; 83 } 84 } 85 | Popular Tags |