我正在创建一个Web应用程序,其中用户名带有空格。我使用方法trim()来删除空格。这在Glass Fish服务器上运行良好。当我将相同的应用程序迁移到tomcat服务器(版本7)时,它指出了我使用.trim()甚至.split方法的确切行上的错误。
org.apache.jasper.JasperException: An exception occurred processing JSP page /userpage.jsp at line 195
192: <tr>
193: <%String store=(String)pageContext.getAttribute("Uname", PageContext.SESSION_SCOPE);
194: System.out.println("scope: "+ store);
195: store.trim();
196: %>
197: <td><input type="hidden" name="email" value="<%=(String)pageContext.getAttribute("Uname", PageContext.SESSION_SCOPE)%>" /></td>
198: </tr>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)