This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

HTTP Status 404 - The requested resource is not available.

 
suraj malla
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following are the details of my Spring-MVC Application. The application compiled properly.While running the application with the URL http://localhost:8080/FirstSpringMVC/studentAdmissionForm.html , I am getting an error as shown in the below Screenshot 1. I am confused of why it is expecting studentAdmissionForm.jsp when I am passing LoginForm.jsp in the model.I tried with various changes following some blogs but still not able to.Please have a look at other screenshots too for my complete code.


Please help me in resolving this issue.

Screenshot 1
-------------------
HTTP Status 404 - /FirstSpringMVC/WEB-INF/Pages/studentAdmissionForm.jsp

type Status report

message /FirstSpringMVC/WEB-INF/Pages/studentAdmissionForm.jsp

description The requested resource is not available.

Apache Tomcat/7.0.54




Screenshot 2 -----Spring-dispatcher-servlet.xml
--------------------


Screenshot 3----Web.xml
--------------------




Screenshot 4---StudentAdmissionController.java
-------------------


ScreenShot-5 ---LoginForm.jsp
---------------------



ScreenShot6----SubmitForm.jsp
------------------



Screenshot 7---HelloController.java
--------------------

Screenshot 8 ---HelloPage.jsp
----------------------

Thanks in Advance
 
vysh sri
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I am new to spring. I am just trying to understand the problem.

@RequestMapping(value="/studentAdmissionForm.html",method=RequestMethod.GET)
public ModelAndView getAdmissionForm(){
ModelAndView model = new ModelAndView("LoginForm");
//model.addObject("name","name");



You say that LoginForm only should be called since you have created ModelAndView("LoginForm")

But as far as I understand, whatever you give in "action" in your jsp, only that will be executed. Your jsp says to call submitAdmissionForm.html.

<html>

<body>
<h1>Login Form</h1>
<form action="/FirstSpringMVC/submitAdmissionForm.html" method="post">
<div>



One more point, in jsp, you should have used <form:form> instead of <form> tag, right?

Kindly post solution, if you have found. It would be helpful for others.
 
suraj malla
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

vysh sri wrote:Even I am new to spring. I am just trying to understand the problem.

@RequestMapping(value="/studentAdmissionForm.html",method=RequestMethod.GET)
public ModelAndView getAdmissionForm(){
ModelAndView model = new ModelAndView("LoginForm");
//model.addObject("name","name");



You say that LoginForm only should be called since you have created ModelAndView("LoginForm")

But as far as I understand, whatever you give in "action" in your jsp, only that will be executed. Your jsp says to call submitAdmissionForm.html.

<html>

<body>
<h1>Login Form</h1>
<form action="/FirstSpringMVC/submitAdmissionForm.html" method="post">
<div>



One more point, in jsp, you should have used <form:form> instead of <form> tag, right?

Kindly post solution, if you have found. It would be helpful for others.




Thanks for the reply @Vysh sri ...
I have been following Gontu Series tutorials for the past few days.As per the tutorial the gsp name provided in ModelAndView helps in forming the URL.Even I tried an example before and its working.For this second example i am facing this issue.
Also as you mentioned form:form tag,i tried it but it is giving me a warning as unknown tag..
Still this issue is not resolved..
 
johnyy Doe
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This happens if your mapping is not correct in web.xml file. I was not able to compile and run all your code but point you the good tutorial to where you have many examples available on Spring MVC.

Sample Hello world example: Spring MVC Hello World

Please take look at: Spring tutorial
 
suraj malla
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally I got the solution after a lot of struggle.The problem is with the import statement for ModelAndView in the controller..
I need to use import org.springframework.web.servlet.ModelAndView; but i used import org.springframework.web.portlet.ModelAndView;

Thanks for your interest in helping me.. @Vysh sri and @johnyy Doe
 
Why fit in when you were born to stand out? - Seuss. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic