Organizational Research By

Surprising Reserch Topic

there is no action mapped for namespace user and action name useradd assoc


there is no action mapped for namespace user and action name useradd assoc  using -'java,jsp,struts2'

After clicking on the URL in the index.jsp page, it returns the message

There is no Action mapped for namespace [/user] and action name [user!add] associated with context path [/Struts2]. - [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:552)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)

You are seeing this page because development mode is enabled. Development mode,
or devMode, enables extra debugging behaviors and reports to assist developers.
To disable this mode, set:
   struts.devMode=false
 in your WEB-INF/classes/struts.properties file.


Project structure:


  /Struts2/WebRoot/WEB-INF/web.xml
  
  /Struts2/src/struts.xml
  
  /Struts2/WebRoot/index.jsp
  
  /Struts2/WebRoot/user_add_success.jsp
  
  /Struts2/src/com/bjsxt/struts2/user/action/UserAction.java
  
  /Struts2/src/com/bjsxt/struts2/user/model/User.java


the struts package I import


  
  /Struts2/WebRoot/WEB-INF/lib/commons-fileupload-1.3.jar
  /Struts2/WebRoot/WEB-INF/lib/commons-io-2.2.jar
  /Struts2/WebRoot/WEB-INF/lib/commons-lang3-3.1.jar
  /Struts2/WebRoot/WEB-INF/lib/commons-logging-1.1.jar
  /Struts2/WebRoot/WEB-INF/lib/freemarker-2.3.19.jar
  /Struts2/WebRoot/WEB-INF/lib/javassist-3.11.0.GA.jar
  /Struts2/WebRoot/WEB-INF/lib/ognl-3.0.6.jar
  /Struts2/WebRoot/WEB-INF/lib/struts2-core-2.3.16.jar
  /Struts2/WebRoot/WEB-INF/lib/xwork-core-2.3.16.jar
  


/Struts2/WebRoot/WEB-INF/web.xml

   <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_9" 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>Struts Blank</display-name>
    <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>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>


/Struts2/src/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.devMode" value="true" />
<package name="user" extends="struts-default" namespace="/user">      
    <action name="user" class="com.bjsxt.struts2.user.action.UserAction">
        <result>/user_add_success.jsp</result>
    </action>
</package>
</struts>


/Struts2/WebRoot/index.jsp

<?xml version="1.0" encoding="GB18030" ?>
<%@ page language="java" contentType="text/html; charset=GB18030"  pageEncoding="GB18030"%>
<%
   String path = request.getContextPath();
   String basePath =request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=GB18030" />
<head>
<base href="<%=basePath %>"/>
<title>Insert title here</title>
</head>
<body>
   use Domain Model to recieve param <a href="user/user!add?user.name=a&user.age=8">add</a>
</body>
</html>


/Struts2/WebRoot/user_add_success.jsp

<?xml version="1.0" encoding="GB18030" ?>
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030" />
<title>Insert title here</title>
</head>
<body>
     User Add Success!
</body>
</html>


/Struts2/src/com/bjsxt/struts2/user/action/UserAction.java

package com.bjsxt.struts2.user.action;
import com.bjsxt.struts2.user.model.User;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
private User user;
//private UserDTO userDTO;
public String add() {
    System.out.println("name=" + user.getName());
    System.out.println("age=" + user.getAge());
    return SUCCESS;
}
public User getUser() {
    return user;
}
public void setUser(User user) {
    this.user = user;
}
}


/Struts2/src/com/bjsxt/struts2/user/model/User.java

package com.bjsxt.struts2.user.model;
public class User {
private String name;
private int age;
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public int getAge() {
    return age;
}
public void setAge(int age) {
    this.age = age;
}
}

    
asked Oct 19, 2015 by sameer rathore
0 votes
3 views



Related Hot Questions



Government Jobs Opening


...