首页 新闻 会员 周边 捐助

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

0
悬赏园豆:10 [待解决问题]

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

<package name="test" extends="struts-default">   <action name="login" class="com.jay.UserAction">    <result type="redirect">/user/hello.jsp</result>   </action>  </package>

<s:form action="login">   <s:textfield name="userName" key="username"></s:textfield>   <s:password name="password" key="password"></s:password>   <s:submit key="login"></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.<init>(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)

Jay_彦的主页 Jay_彦 | 初学一级 | 园豆:192
提问于:2014-03-18 11:41
< >
分享
所有回答(1)
0

../user/hello.jsp  

lingjie-qiu | 园豆:1 (初学一级) | 2014-03-18 14:30

??可以写个简单例子说明一下redirect用法不?谢谢

支持(0) 反对(0) Jay_彦 | 园豆:192 (初学一级) | 2014-03-19 09:47
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册