What will happen if the mapping to actionform in the struts-config.xml is mentioned wrong?

Questions by chandrasekhar.d

Showing Answers 1 - 8 of 8 Answers

pavan kumar

  • Nov 23rd, 2007
 

It will return an error
javax.servlet.ServletException: Cannot retrieve definition for form bean (form bean class name) on action FormBean.

Its pretty trivial that their will be a http status 500 error stating that the requested resource wasn't found.

The reason is:--
Its the job of the ActionServlet to create the actionform instance for us and for that it will look into the struts-config.xml file, if the entry in the strut-config.xml for a formbean is invalid [i.e. the class doesn't exist in first place], it will simply throw up an runtime Exception for us, which is pretty logical.

Actually I read the couple of answers above stating that nothing will happen, then I tested it by giving an Invalid class name in the struts-config.xml file. In the action class I am simple returning a value and nothing else.
As expected, it threw up a runtime error, which confirms my understanding above.



Thanks,
Vinay

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions