JSP根据后台控制下拉框默认选项
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <%@ page import="java.io.*,java.util.*,java.sql.*,shouqisystem.user.*" %> <jsp:useBean id="userinfo" scope="request" class="shouqisystem.user.UserInfo"/> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>修改IC卡信息</title> </head> <body background="images/bottom.png" onload="checkModel(monthIncomeTopTen,monthIncomeBottomTen,monthWorkTimeExceed,monthRunKmExceed)"> <br><br><br><br><br> <% String monthIncomeTopTen=""; String monthIncomeBottomTen=""; String monthWorkTimeExceed=""; String monthRunKmExceed=""; String[] kys=request.getParameterValues("pkey"); for(int i=0;i<kys.length;i++){ kys[i]=new String(kys[i].getBytes("iso-8859-1"),"utf-8"); } ResultSet rs=userinfo.queryICcardDataID(Integer.parseInt(kys[0])); while(rs.next()){ monthIncomeTopTen=rs.getString("monthIncomeTopTen"); monthIncomeBottomTen=rs.getString("monthIncomeBottomTen"); monthWorkTimeExceed=rs.getString("monthWorkTimeExceed"); monthRunKmExceed=rs.getString("monthRunKmExceed"); %> <center> <form action="updateEditICcardData.jsp" method="GET"> <table boder="1"> <tr> <td align="right"><span style="color:white">姓名:</span></td> <td><input type="text" name="name" size="20" value="<%=rs.getString("name")%>"/></td> </tr> <tr> <td align="right"><span style="color:white">车牌号:</span></td> <td><input type="text" name="carNum" size="20" value="<%=rs.getString("carNum") %>"/></td> </tr> <tr> <td align="right"><span style="color:white">月份:</span></td> <td><input type="text" name="ICdate" size="20" value="<%=rs.getString("ICdate") %>"/></td> </tr> <tr><span style="color:white"> <td align="right"><span style="color:white">月收入进入前十:</span></td> <td><select name="monthIncomeTopTen" id="monthIncomeTopTen"> <option value="是" <%if(monthIncomeTopTen.equals("是")){ %> selected<%} %>> 是 </option> <option value="否" <%if(monthIncomeTopTen.equals("否")){ %> selected<%} %>> 否 </option> </select> </td> </tr> <tr><span style="color:white"> <td align="right"><span style="color:white">月收入进入后十:</span></td> <td><select name="monthIncomeBottomTen" id="monthIncomeBottomTen"> <option value="是"<%if(monthIncomeBottomTen.equals("是")){ %> selected<%} %>> 是 </option> <option value="否"<%if(monthIncomeBottomTen.equals("否")){ %> selected<%} %>> 否 </option> </select> </td> </tr> <tr><span style="color:white"> <td align="right"><span style="color:white">月工作时间超过360小时:</span></td> <td><select name="monthWorkTimeExceed" id="monthWorkTimeExceed" > <option value="是"<%if(monthWorkTimeExceed.equals("是")){ %> selected<%} %>> 是 </option> <option value="否"<%if(monthWorkTimeExceed.equals("否")){ %> selected<%} %>> 否 </option> </select> </td> </tr> <tr><span style="color:white"> <td align="right"><span style="color:white">月行驶公里超过10000公里:</span></td> <td><select name="monthRunKmExceed" id="monthRunKmExceed"> <option value="是"<%if(monthRunKmExceed.equals("是")){ %> selected<%} %>> 是 </option> <option value="否"<%if(monthRunKmExceed.equals("否")){ %> selected<%} %>> 否 </option> </select> </td> </tr> <tr> <td><input type="hidden" name="ID" size="20" value="<%=String.valueOf(rs.getInt("ID")) %>"></td> </tr> <% } rs.close(); userinfo.close_all(); %> <tr align="right"> <td colspan="2"> <input type="submit" name="submit" value="修改"> <input type="reset" name="reset" value="重置"> </td> </tr> </table> </center> <br><br> </body> </html>