怎样提取表单内容

来源:百度知道 编辑:UC知道 时间:2024/05/22 19:27:06
比如说我有这样的一个表单
<form id="form1" name="form1">
<div>
<table>
<tr>
<td>
<input id="location" name="location" type="text"/>
</td>
</tr>
</table>
</div>
</form>
问怎样才能不用javasript 提取到location 中的内容呢?
我用的语言是jsp.
恩,,,就是说怎样用jsp语言来提取输入区域的内容,
要是不通过接受页面怎样获取呢。。?

在js里边加入
var location = document.getElementById( "location" );
就获取了!
要好似jsp页面获取就是在接收页
String location=request.getParameter("location");

在js里边加入
var location = document.getElementById( "location" );
就获取了!
要好似jsp页面获取就是在接收页
String location=request.getParameter("location");
回答者: lovefeiyiran - 举人 四级 9-5 15:15

和Servlet方式一样,request.getParameter("location");


<%
String location = request.getParameter("location");
%>

<form id="form1" name="form1"> 这行里面添加action="接收页面.jsp" method="POST"
在接收页面里request.getParameter("location");提取这个表单值

使用request.getParameter("location");获得