• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 : There is no Action mapped for namespace [/] and action name [login] associated with conte

 
Sunny Kumar Kalra
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am facing issue of

There is no Action mapped for namespace [/] and action name [login] associated with context path [/StrutsAndHibernate]. - [unknown location]

In Struts.xml
--------------
<package name="default" extends="struts-default" namespace="/">
<action name="login" class="net.neo.sb.LoginAction"
method="checkLogin">
<result name="success">jsp/Welcome.jsp</result>
<result name="error">jsp/index.jsp</result>
</action>
</package>

In Index.jsp
----------------
<s:form name="frmLogin" action="login">
<s:textfield id="username" name="userName" label="User Name"></s:textfield>
<s:password name="password" label="Password"></s:password>
<s:submit align="center"></s:submit>
</s:form>

In Web.xml
--------------
<display-name>HelloWorldStruts</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
<!-- org.apache.struts2.dispatcher.FilterDispatcher-->
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>jsp/index.jsp</welcome-file>
</welcome-file-list>
</web-app>


So i am able to launch initial index.jsp, but when I try to submit on index.jsp I get following exception :

There is no Action mapped for namespace [/] and action name [login] associated with context path [/StrutsAndHibernate]. - [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:215)

I know its something associated with namespace mapping because if I keep index.jsp and welcome.jsp directly in WebContent folder and make changes accordingly in welcome-file-list then it works.

Please help me to resolve the issue
DirectoryStructure.png
[Thumbnail for DirectoryStructure.png]
DirectoryStructure
 
Yogesh Lonkar
Ranch Hand
Posts: 94
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suggestion please use Code tag while posting code
and as far the your problem it can be because of many reasons such as
1. You are missing some necessary .jar file inside you lib folder
2. You have conflicting jar files inside your lib folder such as struts2-core-2.1.6 and struts2-core-2.1.8.1 in this case only 1 out of 2 should exist
3. your struts.devMode is turned OFF by default which you can turn ON by using this line inside your struts.xml
4. and probably your web.xml is configured wrong it should contain

instead of org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic