2013年12月17日星期二

struts2 spring issue of

struts2.xml

"- / / Apache Software Foundation / / DTD Struts Configuration 2.3 / / EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">




/ jsp / success.jsp
/ jsp / login.jsp




applicationContext.xml


xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: aop = "http://www.springframework.org/schema/aop"
xmlns: tx = "http://www.springframework.org/schema/tx"
xsi: schemaLocation = "
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd ">










web.xml


xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">

struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter


struts2
/ *


contextConfigLocation
/ WEB-INF/classes/applicationContext.xml


org.springframework.web.context.ContextLoaderListener



question :
struts.xml the package after adding namespace attribute , action can not be found After
not add namespace attribute , you can find action
seek expert advice about

visit url: http://localhost:8080/myjsp/mypkg/test/login

exception log:
Information : JK: ajp13 listening on / 0.0.0.0:8009
2013-12-16 21:28:43 org.apache.jk.server.JkMain start
Information : Jk running ID = 0 time = 0/22 config = null
2013-12-16 21:28:43 org.apache.catalina.startup.Catalina start
Information : Server startup in 5770 ms
2013-12-16 21:31:33 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
Warning : Could not find action or result
There is no Action mapped for action name login -. [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare (DefaultActionProxy.java: 185)
at org.apache.struts2.impl.StrutsActionProxy.prepare (StrutsActionProxy.java: 63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy (StrutsActionProxyFactory.java: 39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy (DefaultActionProxyFactory.java: 58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java: 501)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction (ExecuteOperations.java: 77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter (StrutsPrepareAndExecuteFilter.java: 91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java: 233)
at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java: 191)
at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java: 127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 102)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java: 109)
at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 291)
at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java: 859)
at org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process (Http11Protocol.java: 602)
at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run (JIoEndpoint.java: 489)
at java.lang.Thread.run (Thread.java: 619)






------ Solution ------------------------------------ --------
http://localhost:8080/myjsp/mypkg/test/login
changed
http://localhost:8080/myjsp/test/login

没有评论:

发表评论