java - Struts2:There is no Action mapped for namespace [/] and action name [] associated with context path -
i'm new struts2. i'm sorry i've tried different solutions suggested on stackoverflow,they didn't worked. followed these tutorial's instructions:http://www.tutorialspoint.com/struts_2/ can me?
this error:
avvertenza: not find action or result: /hellowordstrut2/hello?name=aaa there no action mapped namespace [/] , action name [hello] associated context path [/hellowordstrut2]. - [unknown location] @ com.opensymphony.xwork2.defaultactionproxy.prepare(defaultactionproxy.java:185) @ org.apache.struts2.impl.strutsactionproxy.prepare(strutsactionproxy.java:63) @ org.apache.struts2.impl.strutsactionproxyfactory.createactionproxy(strutsactionproxyfactory.java:37) @ com.opensymphony.xwork2.defaultactionproxyfactory.createactionproxy(defaultactionproxyfactory.java:58) @ org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:554) @ org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:81) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:99) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:241) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:220) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:505) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:169) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:956) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:423) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1079) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:625) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:318) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(unknown source)
this workspace:
my struts.xml:
<?xml version="1.0" encoding="utf-8"?> <struts> <constant name="struts.devmode" value="true" /> <package name="helloworld" extends="struts-default"> <action name="hello" class="com.tutoriaspoint.struts2.hellowordaction" method="execute"> <result name="success">helloword.jsp</result> </action> </package> </struts>
my web.xml:
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>struts 2</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
my action class:
package com.tutoriaspoint.struts2; public class hellowordaction { private string name; public string getname(){ return name; } public void setname(string name){ this.name=name; } public string execute() throws exception { return "succes"; } }
Comments
Post a Comment