<form name="form1" action="a.jsp" method="post">
<select name="b">
<%
ResultSet result=connectSql.executeQuery("select distinct [name] from 表名 where username='"+username+"'");
while(result.next()){
%>
<option value="<%=result.getString("name")%>"><%=result.getString("name")%></option>
<%}%>
</select>
<input type="submit" value="跳转"/>
</form>做了这样一个下拉框,option的值从数据库读取,a.jsp有一个同样的下拉框,在这个页面选中一个option,点击跳转提交到a.jsp后,怎样使a.jsp中的select被选中的值是刚刚所提交的?
<select name="b">
<%
ResultSet result=connectSql.executeQuery("select distinct [name] from 表名 where username='"+username+"'");
while(result.next()){
%>
<option value="<%=result.getString("name")%>"><%=result.getString("name")%></option>
<%}%>
</select>
<input type="submit" value="跳转"/>
</form>做了这样一个下拉框,option的值从数据库读取,a.jsp有一个同样的下拉框,在这个页面选中一个option,点击跳转提交到a.jsp后,怎样使a.jsp中的select被选中的值是刚刚所提交的?
<form name="form1" action="a.jsp" method="post">
<select name="b">
<%
ResultSet result=connectSql.executeQuery("select distinct [name] from 表名 where username='"+username+"'");
while(result.next()){
%>
<option value=" <%=result.getString("name")%>"> <%=result.getString("name")%> </option>
<%}%>
</select>
<input type="submit" value="跳转"/>
</form>