1 23 24 package org.infoglue.deliver.taglib.common; 25 26 import javax.servlet.jsp.JspException ; 27 28 import org.infoglue.deliver.taglib.TemplateControllerTag; 29 30 public class URLEncodeTag extends TemplateControllerTag { 31 private static final long serialVersionUID = 4050206323348354355L; 32 33 private String value; 34 private String encoding; 35 36 public URLEncodeTag() 37 { 38 super(); 39 } 40 41 public int doEndTag() throws JspException 42 { 43 try 44 { 45 if(this.encoding == null) 46 setResultAttribute(this.getController().getVisualFormatter().encodeURI(value)); 47 else 48 setResultAttribute(this.getController().getVisualFormatter().encodeURI(value, encoding)); 49 } 50 catch (Exception e) 51 { 52 e.printStackTrace(); 53 } 54 55 return EVAL_PAGE; 56 } 57 58 public void setValue(String value) throws JspException 59 { 60 this.value = evaluateString("URLEncode", "value", value); 61 } 62 63 public void setEncoding(String encoding) throws JspException 64 { 65 this.encoding = encoding; 66 } 67 } 68 | Popular Tags |