Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to redirect the page through dispatcher

 
Padhma Prema
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have the below code. Its a shopping cart, being done via MVC.
The below is the controller code and below it is the bean code.

When I add an item and try to click on view cart, it is supposed to go to processViewAction in the controller and retrive the items added from the latest cart and redirect to view cart.jsp and display the cart....

but it wont, it gives me a internal error. could someone throw some light on this please.




the bean code:



viewcart.jsp


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Padhma Prema wrote: it gives me a internal error. could someone throw some light on this please.

Please read this.
 
Padhma Prema
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, my mistake. I should have been more clear.

What is supposed to happen:

I have a .html page - where there are 5 check box options to pick and add them to cart.
there is a add to cart button.

on the click of add to cart,it contact the controller, a new session is created, add's the added items to cart, addsthe result to the bean and i add the b ean to the session and using request dispatcher, the check marked items will get displayed in itemsAdded.jsp

There is a view cart button in this itemsadded.jsp, on the click of view cart, it goes back to the cocntroller, gets the data from the bean and request dispatcher the added items are displayed in the cart via the viewcart.jsp page specified in request dispatcher.

What happens:
On the click on view cart button in itemsAdded.jsp, it gives me a error code 500 pointing to processViewAction and says null point exception. i am unable to figure out the null point here.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the stack trace (which you should always post). it will tell what line number the NPE occurred on.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic