在a.jsp页面上有下拉列表,跳转到b.jsp页面上,我想要在b.jsp上把a.jsp页面上选中的下拉列表的项显示成默认状态,应该怎么做?请举个例子说明!谢谢大家
在线等

解决方案 »

  1.   

    a页面的信息保存 然后b页面查出来。
    struts2  <s:if test="">selected='selected'</s:if>
    不知道符合你需求不
      

  2.   

    a.jsp
    <select id="a">
     <option value="1">1</option>
     <option value="2">2</option>
    </select>
    b.jsp
    <%
    String str=request.getParameter("a");
    int a=Integer.parseInt(str);
    if(a==1){
    %>  
     <select id="a">
     <option value="1" selected>1</option>
     <option value="2">2</option>
     </select><%}else if(a==2){%>
     <select id="a">
     <option value="1" >1</option>
     <option value="2" selected>2</option>
     </select>
    <%}}
    %>