jsp 取自身输入参数

来源:百度知道 编辑:UC知道 时间:2024/07/05 07:12:04
%>
<table width="100%" border="1">
<tr>
<td width="80" align="left">Name :<%=tname%></td>
<td align="left" width="120">
<input type="button" name="MyBtn" value="MyMessage" style="float:right" onclick ="window.location.href='/testweb/addTopic.jsp'">
</td>

<td width="120" align="right">
<form method="post" action="/testweb/main.jsp">
<input type="test" name="topicname">
</form>
</td>
<td>
<input type="button" value="Select" onclick ="window.location.href='/testweb/main.jsp">
</td>
<td width="80" align="right">
<input type=&quo

你不需要写
onclick ="window.location.href='/testweb/main.jsp

因为<form>的action属性已经指明了提交后所转向的文件

表单提交后就能自动接收参数了~

可以改成:<input type="submit" value="Select" >

submit按钮是专门用于提交表单的;