request.getParameter获得下拉菜单的值为空怎么办

来源:百度知道 编辑:UC知道 时间:2024/06/17 11:45:08
小弟最近作了2个页面,第一个页面是把数据库中的信息全部读出来,并且作了2个下拉菜单,name分别为a,b;单击本页面的提交按钮,直接提交到第2个页面;这个页面中开始的地方用String a=request.getParameter("a");String b=request.getParameter("b");获得所选下拉菜单的值,但是空值,怎么回事!请好心的大哥大姐帮帮忙啊!小弟谢了!
第一个页面的代码:
<form method="post" action="Untitled-2.jsp" name="form1">
<table width="300" height="129" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><label>
<select name="area">
<option value="t">天津</option>
<option value="s">上海</option>
</select>
</label>
<label>
<input type="submit" name="Submit" value="提交" />
</label></td>
</tr&

第二页的<%request.getParameter("area");%>改成<%=request.getParameter("area")%>就可以得到下拉框的value值
要获得text值的话好像要用js
document.form1.area.options[document.form1.area.selectedIndex].text
服务器端的不知道怎么写