Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Problem in spring sample application

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you also post index.jsp ?
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes the problem is resolved now
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic