I created a website using jsp and servlet. I made a shopping cart and got the items to display. But how can i remove the items from the cart? Next to each item is a remove button. When that is pressed the item selected needs to be removed and cart needs to refresh.
When the button is clicked the form will submit. You need to supply an action for the form that invokes a task servlet that controls the process of removing the item from the model. That task servlet can then redirect to the page controller for the cart page which should repaint with the new list.
(I'm assuming you're not wanting to get into Ajax and removing the element without refreshing the page.)
As an aside, the presence of a "processRequest" method leads me to believe that you might be treating GET and POST interchangeably, i.e. doGet and doPost both call processRequest. If that is indeed the case, it will be a problem, since treating GET and POST the same violates the HTTP specification, and will likely lead to problems.
What you currently have in processRequest looks like it should go into doGet, whereas code for removing items from the shopping cart would go into doPost.
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
Free, earth friendly heat - from the CodeRanch trailboss