Jsp和html img按钮可以获取request.getParameter的值
这是我的密码Jsp和html img按钮可以获取request.getParameter的值,html,jsp,Html,Jsp,这是我的密码 <% if(request.getParameter("cart") != null) { ...... } <% <form method="post"><input class="auto-style2" height="44" name="cart" src="divers/panier.jpg" type="image" width="71" /> 当我点击img
<%
if(request.getParameter("cart") != null)
{
......
}
<%
<form method="post"><input class="auto-style2" height="44" name="cart"
src="divers/panier.jpg" type="image" width="71" />
当我点击img时,如何知道它是一个帖子
检查请求方法
if ("post".equalsIgnoreCase(request.getMethod())) {
// It's a POST request.
}
或者,更好的做法是,让表单提交到,并在doPost()
方法中完成工作
与具体问题无关,您实质上滥用了这里的
,只需要一个带有背景图像的按钮。它不会发送请求参数cart
,而是将鼠标光标位置作为cart.x
和cart.y
发送到图像上。您需要检查这些参数
if (request.getParameter("cart.x") != null) {
// Image button is clicked.
}
另请参见。您能再清楚一点吗?您正在尝试获取有关图像的信息吗?或者只是知道一张图片被点击发布帖子?我只是想知道一张图片被点击发布帖子!!!请看检查答案和巴卢斯克的答案,谢谢您的帮助,祝您一切顺利!