请问!?
在一个jsp页面中可以嵌套表单么?!
例如:
<form name="form1"...>
....
<form name="form2"...>
...
</form>
...
</form>这样可以么?!

解决方案 »

  1.   

    可以呀,看你用两个表单的用途!<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>">
    <title>一个页面两个form表单的问题</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    count=count+1;
    var timerID=window.setTimeout("check();",1000);
    if(count>=10)
    {
    window.clearTimeout(timerID);
    return true;
    }
    -->
    <script type="text/javascript">
    function test()
    {
    var b=document.getElementById("button_one");
    var bresult=b.value;
    document.getElementById("result").innerHTML="中转后的值为:"+bresult;
    }
    function check()
    {
    var count;
    test();
    return true;
    }
    </script>
    </head>
    <body>
    <form action="<%=path%>/common/TestFour.jsp" method="post"
    name="myform" onsubmit="return check();">
    <table>
    <tr>
    <td>
    <input type="text" name="button_one" id="button_one" value="2008"
    size="8" />
    </td>
    <td>
    <input type="submit" name="submit" size="8" value="跳转" />
    </td>
    </tr>
    </table>
    <form action="#" method="post" name="myformtwo">
    <table>
    <tr>
    <td>
    <div title="中转值" id="result" align="left"
    style="color: blue;text-decoration: none;border: 1px,solid;background-color: red"></div>
    </td>
    </tr>
    </table>
    </form>
    </form>
    </body>
    </html>