1 16 19 20 package org.apache.pluto.tags; 21 22 import javax.portlet.PortletURL; 23 import javax.servlet.jsp.JspException ; 24 import javax.servlet.jsp.tagext.TagSupport ; 25 26 27 37 public class ParamTag extends TagSupport 38 { 39 40 private String name; 41 private String value; 42 43 47 public int doStartTag() throws JspException 48 { 49 BasicURLTag urlTag = (BasicURLTag)findAncestorWithClass(this, BasicURLTag.class); 50 if (urlTag == null) 51 { 52 throw new JspException ("the 'param' Tag must have actionURL or renderURL as a parent"); 53 } 54 PortletURL url = urlTag.getUrl(); 55 56 if (getName() != null) 57 { 58 url.setParameter(getName(),getValue()); 59 } 60 61 return SKIP_BODY; 62 } 63 64 68 public String getName() 69 { 70 return name; 71 } 72 73 77 public String getValue() 78 { 79 if (value == null) 80 { 81 value = ""; 82 } 83 return value; 84 } 85 86 90 public void setName(String name) 91 { 92 this.name = name; 93 } 94 95 99 public void setValue(String value) 100 { 101 this.value = value; 102 } 103 104 } 105 | Popular Tags |