2 jay568774866 JAY568774866 于 2014.03.18 11:48 提问

struts2中 redirect重定向怎么弄都不行啊,求高手解答。。。

在webroot根目录下建一个login.jsp文件,在struts.xml文件中配置如下,使其redirect重定向到/user/hello.jsp页面,在webroot根目录下已创建一个文件夹user,文件夹中已有hello.jsp。运行报错如下。





/user/hello.jsp





/s:textfield

/s:password

/s:submit

/s:form

严重: Servlet.service() for servlet [jsp] in context with path [/test2] threw exception [java.lang.IllegalArgumentException: can't parse argument number: userName] with root
cause java.lang.NumberFormatException: For input string: "userName"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492)

at java.lang.Integer.parseInt(Integer.java:527)

at java.text.MessageFormat.makeFormat(MessageFormat.java:1418)

at java.text.MessageFormat.applyPattern(MessageFormat.java:479)

at java.text.MessageFormat.(MessageFormat.java:363)

at com.opensymphony.xwork2.util.LocalizedTextUtil.buildMessageFormat(LocalizedTextUtil.java:704)
at com.opensymphony.xwork2.util.LocalizedTextUtil.findDefaultText(LocalizedTextUtil.java:229) at com.opensymphony.xwork2.DefaultTextProvider.getText(DefaultTextProvider.java:67) at com.opensymphony.xwork2.DefaultTextProvider.getText(DefaultTextProvider.java:82) at com.opensymphony.xwork2.DefaultTextProvider.getText(DefaultTextProvider.java:129) at org.apache.struts2.util.TextProviderHelper.getText(TextProviderHelper.java:75) at org.apache.struts2.components.Text.end(Text.java:160)

at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)

at org.apache.jsp.user.hello_jsp._jspx_meth_s_005ftext_005f1(hello_jsp.java:165) at org.apache.jsp.user.hello_jsp._jspService(hello_jsp.java:96)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744)

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!