Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible problem with getRequestDispatcher() method.

 
Varnam Aayiram
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,

I changed to a lowercase 'name' and the problem was solved. Thanks.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to hear you figured it out!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic