I have this code in my jsp
<div class="controls">
<input type="image" class="sprite submit-button button" name="SubmitChangeCreds" value="ChangeUIDSubmit" src="../images/layout/transparent.png" />
</div>
In my servlet I am trying to get the value of this image like this
request.getParameter("SubmitChangeCreds")
But this is null.
Help will be much appreciated.
As per the HTML specification, the
input type="image"is to be used as an image map. The webbrowser will send the x and y position of the mouse pointer to the server when the enduser clicks on the image map. The submitted value is available asoriginalname.xandoriginalname.y.So in your case:
However, you seem after all to be abusing the
input type="image"since you don’t seem to be interested in the mouse position. I’d suggest to just useinput type="submit"wherein the image is specified as a CSS background image.E.g.
with e.g.
That’s a more correct usage of background images in buttons.