更新时间:2023-12-04 15:50:46
你可以给提交按钮一个特定的名字。
You can just give the submit button a specific name.
<input type="submit" name="action1" value="Invoke action 1" />
<input type="submit" name="action2" value="Invoke action 2" />
<input type="submit" name="action3" value="Invoke action 3" />
按下按钮的名称 - 值对按常规方式作为请求参数提供。
The name-value pair of the pressed button is available as request parameter the usual way.
if (request.getParameter("action1") != null) {
// Invoke action 1.
}
else if (request.getParameter("action2") != null) {
// Invoke action 2.
}
else if (request.getParameter("action3") != null) {
// Invoke action 3.
}