This is my code
<%
if(request.getParameter("cart") != null)
{
......
}
<%
<form method="post"><input class="auto-style2" height="44" name="cart"
src="divers/panier.jpg" type="image" width="71" />
So when I press the button name=”cart” I can get request.getParameter(“cart”).
How to know its a post back when I click on the img ?
Check the request method.
Or, better, let the form submit to a servlet and do the job in
doPost()method.Unrelated to the concrete problem, you’re in essence abusing the
<input type="image">here to have just a button with a background image. It will not sent a request parametercart, but instead send the mouse cursor position on the image ascart.xandcart.y. You need to check those parameters instead.See also HTML Input (type=image) not working on Firefox 4.