Get your CodeRanch badge!*
The moose likes Servlets and the fly likes Possible problem with getRequestDispatcher() method. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Possible problem with getRequestDispatcher() method." Watch "Possible problem with getRequestDispatcher() method." New topic
Author

Possible problem with getRequestDispatcher() method.

Varnam Aayiram
Ranch Hand

Joined: Dec 23, 2008
Posts: 88
Hi Folks..

I am testing out a simple webapp conforming to MVC. I suspect that I might be having a possible problem with the getRequestDispatcher() method. The files used are: 'bookingForm.jsp', 'bookingconfirmed.jsp', 'bookingFormServlet.java' and 'bookingFormBean.java'.

The user fills up the 'bookingForm.jsp' with the value 'jack' and clicks on submit button. The 'bookingFormServlet.java' servlet manages to call the 'setName' method of the 'bookingFormBean.java' and passes the value 'jack' to it. This much works fine, I confirmed this by doing a print statement in the setName method just after the 'this.Name = Name' assignment, and the value 'jack' is printed out in the stack trace.

However the user is getting a 'Http status 500' error in the browser after filling up the form and clicking submit, that says:
'org.apache.jasper.JasperException: PWC6054: Cannot find any information on property 'Name' in a bean of type 'com.ProjecteBooking4.controller.bookingFormBean'' .

The stack trace says:
at com.ProjecteBooking4.controller.bookingFormServlet.processRequest(bookingFormServlet.java:37)
at com.ProjecteBooking4.controller.bookingFormServlet.doPost(bookingFormServlet.java:62)

and clicking on them brings me to the following lines in the servlet:
request.getRequestDispatcher("bookingconfirmed.jsp").forward(request, response);
processRequest(request, response);

The print statement I placed just above request.getRequestDispatcher("bookingconfirmed.jsp").forward(request, response); never gets printed, I belive this means, the program for some reason dosent get further than this due to some error. I am not sure what is causing the error, I hope someone can help. All the source code is mentioned below:

bookingForm.jsp


bookingFormServlet.java


bookingFormBean.java


bookingonfirmed.jsp


web.xml


Really hope someone can help put out to me what is wrong. Thanks.




David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Did you try a lowercase "name", to match JavaBean property conventions?

Neither the package nor class name conform to conventional Java naming practices, either, which won't cause the error, but *will* cause confusion.
Varnam Aayiram
Ranch Hand

Joined: Dec 23, 2008
Posts: 88
Hi David,

I changed to a lowercase 'name' and the problem was solved. Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Glad to hear you figured it out!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Possible problem with getRequestDispatcher() method.
 
Similar Threads
HTTP Status 404 -
SessionServlet and Login.jsp
error message
Storing resultset into arraylist
'The requested resource is not available' error