<option value="0" <%if("0".equals(數據庫中抓出的邊量名))out.println("selected");%>>本科</option>

解决方案 »

  1.   

    那你不如在SQL语句里处理,
    select 文化=case 文化程度 when '1' then '本科' when '2' then '大专' ...end from ..但是如能更改表结构最好在建一个字典表,来对应 文化程度 这样易于扩充
      

  2.   

    首先你要建立个FormBean先啦,属性为数据类型的,在前台jsp中:
    <html:multibox property="属性名" value="提交或者根据值显示的" />
      

  3.   

    answer:
    <form name="login" action="check.jsp" method="post">
    用户名:<input type="text" name="username" size="7"> 
    密码:<input type="password" name="password" size="7">
    <input type="radio" name="education" checked value="0" />no
    <input type="radio" name="education" value="1" />bachelor
    <input type="radio" name="education" value="2" />college
    <input type="radio" name="education" value="3" />high school
    </form>
    -------------check.jsp-----------
    <%
    String name=request.getParameter("username");
    String pass=request.getParameter("password");
    String edu=request.getParameter("education");
    %>
    <%int educhoice=Integer.parseInt(edu); 
    String sql;String condition;
    switch(educhoice){
    case 0:
       condition="edu='no'";
       break;
    case 1:
       condition="edu='bachelor'";
       break;
    ....
    }
    sql="select * from user where user='"+name+"' and pass='"+pass+"' and "+condition+";";
    .........
    //query database here!
    %>