Shopping Cart Servlet and Refresh

N

newbie29

I have a shopping cart servlet that adds to the cart when "add" is
pressed. Unfortunately, it also unwantingly adds to the cart whenever
I refresh the page. Has anyone encountered this?

I'm assuming that since I refresh that the servlet is called again and
thus performs the adding.

Does anyone know how to solve this?

Thanks,
N29
 
R

Robert

Since you didn't put the jsp code in your message I can only assume
that you're not passing or looking for a special variable on submit.
If you're using submit. Maybe you're just using a link or an image with
an onclick who knows in any event you need to set a variable in the jsp
or html page when the user clicks. Then look for it in the servlet.
Also clear it out when the page loads. So refresh doesn't call it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top