• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in spring sample application

 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

i have just started with spring and after reading i decided to go practical. So i tried my hands witht he sample application provided at spring web-site ( http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step.html).

The file structure here is as follows :

springapp---->war---->WEB-INF----->jsp--->include.jsp
springapp---->war---->WEB-INF----->jsp--->hello.jsp
springapp---->war---->index.jsp
springapp---->src----->SpringappController.java

first i copied the code in webapps folder of tomcat and try to run, but failed than i removed the war folder and make classes and lib folder in WEB-INF and put the controller in classed and try to run, it workes, but my index page is just redirecting to hello page which will obvously go through controller and controller will pass teh succes view with current time to hello page and hello page gets displayed. But my servert gives me an error as hello page is not found. I am putting up my springapp-servlet.xml and controller here because rent of the coding is too simple.

web.xml




springapp-servlet.xml



please keep considering my new file structure :

springapp---->WEB-INF----->jsp--->include.jsp
springapp---->WEB-INF----->jsp--->hello.jsp
springapp---->WEB-INF----->classes--->SpringappController.class
springapp---->WEB-INF----->lib--->(All jars)
springapp---->WEB-INF----->web.xml
springapp---->WEB-INF----->springapp-servlet.xml
springapp---->index.jsp


Now can somebody help me out, i don't think so that my application even considering the springapp-servlet.xml.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you also post index.jsp ?
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is the index.jsp. It worked fine but it coudn't find the hello.jsp as it is in
springapp---->war---->WEB-INF----->jsp--->hello.jsp
and index is in
springapp---->war---->index.jsp


<%@ include file="/WEB-INF/jsp/include.jsp" %>

<%-- Redirected because we can't set the welcome page to a virtual URL. --%>
<c:redirect url="/hello.jsp"/>
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the redirecting url is not correct. Try with /springapp/hello.jsp.
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the problem is resolved now
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic