<select name="where"> 
<option value="black"></option> 
<option value="hk">Hong Kong</option> 
<option value="tw">Taiwan</option> 
<option value="cn">China</option> 
<option value="us">United States</option> 
<option value="ca">Canada</option> 
</select> 
 这是一个下拉框,点击保存后,希望页面上表单中的数据是选择的内容,而不是空白。
页面上的所有数据存在一个JAVA类中。请各位帮忙看看。
先谢过了!

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【leafyh】截止到2008-07-08 15:12:20的历史汇总数据(不包括此帖):
    发帖的总数量:7                        发帖的总分数:160                      每贴平均分数:22                       
    回帖的总数量:13                       得分贴总数量:2                        回帖的得分率:15%                      
    结贴的总数量:5                        结贴的总分数:90                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:2                        未结的总分数:70                       
    结贴的百分比:71.43 %               结分的百分比:56.25 %                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    楼主加油
      

  2.   

    在表单提交之后的页面(可能是servlet) request.getParameters("where");
      

  3.   


    所有的数据是放在一个表格中的,比如说:
    <td>地点</td>    
        <td><input name="location" type="text" class="inputtext" value="<%=Sysdd.getValue(name.getLocation())%>"
        style="HEIGHT:15PX; WIDTH:300PX"/></td>
     
    这个下拉框应该具体怎么写呢?
      

  4.   

    action中
    String where = request.getParameter("where");
    request.setAttribute("where",where);
    jsp中<select name="where">
    <option value="black" <%if(request.getAttribute("where").equals("black")){ %> selected="selected"<%} %>></option>
    <option value="hk"<%if(request.getAttribute("where").equals("hk")){ %> selected="selected"<%} %>>Hong Kong </option>
    <option value="hk1"<%if(request.getAttribute("where").equals("hk1")){ %> selected="selected"<%} %>>Hong Kong1 </option>
    ......
    </select>
      

  5.   

    不太明白你想说的是什么问题是SELECT怎么写??我是这样写的
    <select name="Dept">
            
            <%List list=(List)request.getAttribute("dept");
              Dept dept;
              for(int i=0;i<list.size();i++){
                  dept=new Dept();
                  dept=(Dept)list.get(i);
             %>
              
              <option value=<%=dept.getDeptId() %>><%=dept.getDeptName() %></option>
              
            <%} %>
            </select>
      

  6.   

    是从后台取数据回填的问题,楼上的这种办法是可以的,但个人觉得解决的不够彻底,我们的select在一个项目中,数量会很多,每一个都这么写,是不是有点累呢?需要一种通用的解决方案,
    可以参考一下Faceye开源portal里面关于这一点的实现http://ecsun.javaeye.com
      

  7.   

    selected="selected",引号中的selected表示什么意思呢?
      

  8.   

     
    按照您的思路,问题解决了,谢谢了!可以交个朋友吗?我的msn:[email protected]