浏览 4178 次
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2006-12-08
但是通过get方式传递中文变量时,用和post相同方法得到的却是乱麻。 如: <form action="a.jsp" method="post"> <input type="text" value="测试" name="test"><input type="submit" value="提交"> </form> a.jsp中: request.setCharacterEncoding("GB2312") String a = request.getParameter("test"); 得到是不是乱麻 但是通过<a href="a.jsp?test=测试">测试</a>这个连接以上面相同方式得到却是乱麻。 各位高手,是什么原因啊?怎么解决啊?我以前一直用的是jetty4,没有这个问题。 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2006-12-08
不管用什么服务器,使用get方式传递中文,都需要使用URLEncode,
当然对于tomcat,可以设置get使用的编码方式,但那不是最好的方法。前者是。 |
|
返回顶楼 | |
发表时间:2006-12-10
楼上的兄弟
小弟刚接触web服务器 能不能给我详细解释哈在jetty中如何配置URLEncode啊? 我用下面这种方式测试也是乱麻: <a href="c.jsp?test=<%=java.net.URLEncoder.encode("测试","GB2312") %>" target="_blank">测试</a> 多谢多谢! |
|
返回顶楼 | |
发表时间:2007-04-13
我这里却出现这样的错误,google了一下,也没有找到什么有用的信息
HTTP ERROR: 500 gnu.xml.dom.DomDocument.setDocumentURI(Ljava/lang/String;)V RequestURI=/admin/ Caused by: java.lang.AbstractMethodError: gnu.xml.dom.DomDocument.setDocumentURI(Ljava/lang/String;)V at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:213) at org.apache.jasper.compiler.JspConfig.processWebDotXml(JspConfig.java:110) at org.apache.jasper.compiler.JspConfig.init(JspConfig.java:282) at org.apache.jasper.compiler.JspConfig.findJspProperty(JspConfig.java:347) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:126) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:387) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:579) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:464) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:358) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:467) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:715) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:402) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:268) at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126) at org.mortbay.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:418) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:467) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1075) at com.ExtraTrading.filter.AccessRightFilter.doFilter(AccessRightFilter.java:96) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1066) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:715) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:402) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:285) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:469) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:791) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:358) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:365) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) ----------------------------------------------------------- web.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>t</display-name> <description> t system </description> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/schedulingContext-timer.xml</param-value> </context-param> <!-- Define servlet-mapped and path-mapped example filters --> <filter> <filter-name>AccessFilter</filter-name> <filter-class>com.ExtraTrading.filter.AccessRightFilter</filter-class> </filter> </filter> <filter-mapping> <filter-name>AccessFilter</filter-name> <url-pattern>/admin/*</url-pattern> </filter-mapping> <listener> <listener-class>com.ExtraTrading.server.ContextListener</listener-class> </listener> <servlet> <servlet-name>webwork</servlet-name> <servlet-class>com.opensymphony.webwork.dispatcher.ServletDispatcher</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>velocity</servlet-name> <servlet-class>com.opensymphony.webwork.views.velocity.WebWorkVelocityServlet</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> <load-on-startup>3</load-on-startup> </servlet> <servlet-mapping> <servlet-name>webwork</servlet-name> <url-pattern>*.action</url-pattern> </servlet-mapping> <taglib> <taglib-uri>webwork</taglib-uri> <taglib-location>/WEB-INF/lib/webwork-2.1.1.jar</taglib-location> </taglib> </web-app> |
|
返回顶楼 | |