|
Hi all,
I am tring to integrate Struts 2 HelloWorld into my project, but there came the error message: "There is no Action mapped for action name HelloWorld. - [unknown location]", I think it is configuration problem, but do not know how to fix it. My project war structure like these: /myproject/ - index.html -/hello/HelloWorld.jsp -/WEB-INF/ - struts.xml - web.xml -/WEB-INF/lib/web/HelloWorld.class Here is my struts configure file struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="true" /> <package name="hello" namespace="/hello" extends="struts-default"> <action name="HelloWorld" class="web.HelloWorld"> <result>/hello/HelloWorld.jsp</result> </action> </package> </struts> And here is my web.xml file: <?xml version="1.0" encoding="UTF-8"?> <web-app id="GDI" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 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"> <display-name>myproject</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> In the end, I test it in Tomcat using http://localhost:8080/myproject/hello/HelloWorld.action, "There is no Action mapped for action name HelloWorld. - [unknown location] com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186) org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419) " Please help!!! Thanks. |
|
Hi,
struts.xml should be inside the classes dir in the WEB-INF folder, Thanks, Nuwan ----- Original Message ----- From: "lupus" <[hidden email]> To: <[hidden email]> Sent: Monday, July 16, 2007 5:23 PM Subject: Help!_no Action mapped for action name HelloWorld > > Hi all, > > I am tring to integrate Struts 2 HelloWorld into my project, but there > came > the error message: > > "There is no Action mapped for action name HelloWorld. - [unknown > location]", I think it is configuration problem, but do not know how to > fix > it. > > My project war structure like these: > > /myproject/ > - index.html > -/hello/HelloWorld.jsp > -/WEB-INF/ > - struts.xml > - web.xml > -/WEB-INF/lib/web/HelloWorld.class > > Here is my struts configure file struts.xml > > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts > Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> > <struts> > > <constant name="struts.enable.DynamicMethodInvocation" value="false" /> > <constant name="struts.devMode" value="true" /> > > <package name="hello" namespace="/hello" extends="struts-default"> > > <!-- Add actions here --> > <action name="HelloWorld" class="web.HelloWorld"> > <result>/hello/HelloWorld.jsp</result> > </action> > </package> > </struts> > > And here is my web.xml file: > > <?xml version="1.0" encoding="UTF-8"?> > <web-app id="GDI" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" > 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"> > <display-name>myproject</display-name> > > <filter> > <filter-name>struts2</filter-name> > > <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> > </filter> > > <filter-mapping> > <filter-name>struts2</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > > <welcome-file-list> > <welcome-file>index.html</welcome-file> > <welcome-file>index.jsp</welcome-file> > </welcome-file-list> > </web-app> > > > In the end, I test it in Tomcat using > http://localhost:8080/myproject/hello/HelloWorld.action, > > "There is no Action mapped for action name HelloWorld. - [unknown > location] > > com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186) > > org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41) > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494) > > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419) > > " > > Please help!!! > > Thanks. > > -- > View this message in context: > http://www.nabble.com/Help%21_no-Action-mapped-for-action-name-HelloWorld-tf4088830.html#a11622245 > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
| Powered by Nabble | Edit this page |
