首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

一个页面 有两个form 嵌套 为啥里面那个form 提交的是外面的action

2012-09-09 
一个页面 有两个form 嵌套 为什么里面那个form 提交的是外面的action怎么让里面的form 提交对应的action%

一个页面 有两个form 嵌套 为什么里面那个form 提交的是外面的action
怎么让里面的form 提交对应的action


<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<title>用户注册</title>
</head>

<body>

<center>
<form onsubmit="return validateAddAdminForm(this);" method="post"
action="addTeacher.action" >
<table width="776" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td align="left" style="border-bottom: 1px solid #E5E5E5">
<br>
</td>
</tr>
<tr>
<td height="25" align="left">
添加班主任信息
</td>
</tr>
</table>


<!--书签插入位置-->
<table width="776" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="card1" width="776" align="center" bgcolor="#3D84CD"
style="cursor: hand; color: #ffffff; font-size: 14px; font-weight: bold">
基本信息
</td>
</tr>
</table>
<table width="776" border="0" cellspacing="0" cellpadding="0"
style="border: 1px solid #E5E5E5" >
<tr>
<td align="center">

<table width="764" border="0" cellspacing="0" cellpadding="0">
<tr>

<td colspan="4" align="left">
<font style="color: #FAAD45">*</font> 为必填信息:
</td>
</tr>
</table>
<table width="764" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="25" align="center"
style="color: #FAAD45">
*
</td>
<td width="100" height="25" align="center">
班主任名字:
</td>

<td width="177" height="25" align="left">
<span class="table_k_bg1"> <input type="text"
class="input" id="teacherName" name="teacherName" maxlength="20"
size="20" /> </span>
</td>

<td align="left" width="467">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<font color="blue"><div id="result"></div>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>

[align=left][/align]
<table width="764" border="0" align="center" cellpadding="0"
cellspacing="0">

<tr>
<td width="20" align="center" style="color: #FAAD45"></td>
<td width="100" height="35" align="center">
<span id="thePhone1">电话:</span>
</td>
<td width="180" height="35" align="left" valign="middle">


<span class="table_k_bg1"> <input type="text"
class="input" id="phone" name="phone" size="20">
</span>
</td>
<td align="left" valign="middle">
&nbsp;
</td>

</tr>
</table>
<table width="764" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td width="20" align="center" style="color: #FAAD45"></td>
<td width="100" height="35" align="center">
<span id="thePhone1">E-Mail:</span>
</td>
<td width="180" height="35" align="left" valign="middle">
<span class="table_k_bg1"> <input type="text"
class="input" id="email" name="email" size="20">

</span>
</td>
<td align="left" valign="middle">
&nbsp;
</td>
</tr>
</table>
<form name="a" action="upload.action" method="post" enctype="multipart/form-data">
<table width="764" border="0" align="center" cellpadding="0"
cellspacing="0" >
<tr>
<td width="20" align="center" style="color: #FAAD45"></td>
<td width="100" height="35" align="center">
<span id="thePhone1">个人形象:</span>
</td>
<td width="0" height="35" align="left" valign="middle">
<span class="table_k_bg1">

</span>
</td>
<td align="left" valign="middle">
<input name="icon" type="file" value="上传" />
  <input type="submit" value="上传"/>
</td>
</tr>
</table>
</form>
<!--各个书签页的公共操作按钮-->
<table width="576" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td height="23">
&nbsp;
</td>
</tr>
<tr>
<td width="54" height="23" align="center" valign="middle">
<Input type="image"
src="<c:url value='/image/shct10000_main02.gif'/>" width="54"
height="23" onClick="submit" style="cursor: hand" />
</td>
<td width="54" height="23" align="left" valign="middle">
<Input type="image"
src="<c:url value='/image/shct10000_main02.gif'/>" width="54"
height="23" onClick="reset" style="cursor: hand" />
</td>
</tr>
</table>




</td>
</tr>

</table>
</form>
</center>
</body>


</html>

[解决办法]
嵌套的时候内部<form>被忽略.
不要用嵌套的FORM吧:
<input type=submit onsubmit="return false;" onclick="var f=this.form; f.action='upload.action'; f.method='POST'; f.enctype='multipart/form-data'; f.submit();"/>
[解决办法]
不要嵌套<FORM>
[解决办法]
form是不能嵌套的,否则html都是语法错误,如果用dw编辑,你会看到不匹配的标记。

热点排行