1 28 29 package com.caucho.jstl.rt; 30 31 import com.caucho.jsp.PageContextImpl; 32 import com.caucho.util.L10N; 33 34 import javax.servlet.http.HttpServletRequest ; 35 import javax.servlet.jsp.JspException ; 36 import javax.servlet.jsp.jstl.core.Config; 37 import javax.servlet.jsp.tagext.TagSupport ; 38 import java.io.UnsupportedEncodingException ; 39 40 43 public class FmtRequestEncodingTag extends TagSupport { 44 private static L10N L = new L10N(FmtRequestEncodingTag.class); 45 46 private String _value; 47 48 51 public void setValue(String value) 52 { 53 _value = value; 54 } 55 56 59 public int doStartTag() 60 throws JspException 61 { 62 PageContextImpl pc = (PageContextImpl) pageContext; 63 HttpServletRequest request = (HttpServletRequest ) pc.getRequest(); 64 65 try { 66 String value = null; 67 if (_value != null) 68 value = _value; 69 else 70 value = (String ) Config.find(pageContext, "javax.servlet.jsp.jstl.fmt.request.charset"); 71 72 if (value != null && ! value.equals("")) 73 request.setCharacterEncoding(value); 74 } catch (UnsupportedEncodingException e) { 75 throw new JspException (e); 76 } 77 78 return SKIP_BODY; 79 } 80 } 81 | Popular Tags |