File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot retrieve mapping for action

 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am pretty new to Struts. So please bear with me if my question is little childish. I have a JSP which is supposed to call an action but when i hit the submit button, i get an exception that reads "Cannot retrieve mapping for action". Could you please help me out in resolving this...


The JSP that calls the action looks like


The struts config for the action looks like


I also have a form bean that has its definition in struts-config


Thanks

karthick.v@tcs.com
 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A small correction with my query. The JSP itself is not loading now and i am getting the same exception "Cannot retrieve mapping for action"
 
anupa oru
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
according to my knowledge you have to include the name of JSP to which form bean needs to be associated in input attribute of <action> tag in struts-config file
I hope this will work out.
Let me know how it helps.
Thanks
anupa
 
sanat
Ranch Hand
Posts: 111
Eclipse IDE Java Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik,

If you are providing name attributr in <html:form> you should also specify the type attribute.
so try with this

<hr/ >
<html:form action="XXXX" >
<hr/ >
 
sanat
Ranch Hand
Posts: 111
Eclipse IDE Java Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik,

If you are providing name attributr in <html:form> you should also specify the type attribute.
so try with this

 
Hemanth Pallavajula
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I think the value for action attribute of <html:form> should be "AddressValidate.do".

Correct me If I am wrong.
 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I checked with other JSP's in the application. They dont seem to have ".do" extension for the action.
 
JSun Online
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check ur web.xml for your action servlet , and servlet mapping given correctly ,,
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

-----------------------
 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I checked web.xml. It looks fine. Also all other JSP's are working fine. So, i am not sure if it is a problem with web.xml.

Thanks
Karthik
 
sanat
Ranch Hand
Posts: 111
Eclipse IDE Java Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by karthikntcs vijayarajan:
"Cannot retrieve mapping for action"


I think there is some problem with struts-config file. may be some typo errors.
 
sanat
Ranch Hand
Posts: 111
Eclipse IDE Java Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hemanth Pallavajula:
hi,

I think the value for action attribute of <html:form> should be "AddressValidate.do".

Correct me If I am wrong.


I think .do is not mandotary.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic