您的位置:首页 > 编程语言 > Java开发

struts中一个form表单实现多个按钮的提交

2012-05-02 16:54 477 查看
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<html>
<head>

<title>main.jsp</title>

<script type="text/javascript">

function registor(){
document.getElementById("login").action="<%=request.getContextPath()%>/existAction.action";
document.getElementById("login").submit();}

function list(){
document.getElementById("login").action="<%=request.getContextPath()%>/listAction.action";
document.getElementById("login").submit();}

</script>
</head>

<body>
<center>
<h2><font color="red">注册</font></h2>
<form method="post" name="login" id="login">
用户名:<input type="text" name="username">
<input type="button" value="显示数据" onclick="list()">//注意:onclick的方法千万不能喝form表单中定义的name和id重名,否则会报网页上有错
<input type="button" value="注册" onclick="registor()">
</form>
</center>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: