• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot retrieve mapping for action

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 111
Mac Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic