aspose file tools*
The moose likes Spring and the fly likes Not able to run basic spring mvc example? -- Resource not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Not able to run basic spring mvc example? -- Resource not found" Watch "Not able to run basic spring mvc example? -- Resource not found" New topic
Author

Not able to run basic spring mvc example? -- Resource not found

Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

web.xml



spitter-servlet.xml


homeController.java




I am giving the url as http://localhost:8080/SpringMvcExample/home.jsp

and the error is resource not found...In tomcat log i found that showHomePage is invoked..SOP from showHomePage is logged..

whats wrong here?

Please help me..

Thanks in advance..

P.S.: Same posted on stackexchange.com link


Regards
Sudhakar
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 537

First, there is no need for you to initialize spitter-servlet.xml using context-param in web.xml, spring libraries will do it for you..
Try, mapping *.htm requests to springs dispatcher servlet, instead of *.jsp..
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Prasad Krishnegowda wrote:First, there is no need for you to initialize spitter-servlet.xml using context-param in web.xml, spring libraries will do it for you..


Prasad thanks for your reply..

I commented the following code in web.xml


and i am getting the below error:

I think the above line is necessary as i don't have root level context..i just have dispatcher servlet context.

exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

Prasad Krishnegowda wrote:Try, mapping *.htm requests to springs dispatcher servlet, instead of *.jsp..


Same error..

Any other suggestions guys..


EDITED: Prasad, I did not do it correctly, what you said is correct and it is working now..Thanks for reply
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Guys,

This question has been resolved..Please follow this link for the answer link

The issue is for dispatcher servlet url mapping should not be *.jsp..

I don't know why?
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 537

Karnati Sudhakar wrote:Guys,


The issue is for dispatcher servlet url mapping should not be *.jsp..

I don't know why?


This is because, your view also is a JSP, so when the view is rendered it maps to some .jsp page, and the controller again will route it to spring dispatcher servlet... This results in JSP pages not been rendered..
Anyway, glad that it is working now..
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Prasad Krishnegowda wrote:
Karnati Sudhakar wrote:Guys,
The issue is for dispatcher servlet url mapping should not be *.jsp..
I don't know why?

This is because, your view also is a JSP, so when the view is rendered it maps to some .jsp page, and the controller again will route it to spring dispatcher servlet... This results in JSP pages not been rendered..
Anyway, glad that it is working now..


Thanks buddy..seems like these kind of concepts can be learn only through experience..

Thanks for your time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to run basic spring mvc example? -- Resource not found