zoukankan      html  css  js  c++  java
  • 在JSP页面中用select下拉列表来显示List列表的方式

    一 、用struts2标签的<s:select>来显示

    <s:select cssStyle=" 84%" list="#application.officeList" headerKey="" headerValue="--请选择--" listKey="#this.value" listValue="#this.key+'.'+#this.value" name="entity.officeName" value="entity.officeName"/>

     

    其中

    1、list是接收java类或者在启动时就已经加载的application中的list列表值 ;

    2、listKey的值是select的值;

    3、listValue的值是相当于<select>中显示出来的text;

    4、value是java类中传来的值,用来与select列表中的option的id值做对比

     

    二、用<select  来显示从java类端传过来的List列表中的选项

    <select name="entity.officeName">
           <option value="">--请选择--</option>
      <s:iterator value="#application.officeList" id="bean">
    <option value="${bean.value}" <s:if test='#bean.key==entity.officeName'>selected</s:if> >${bean.key}.${bean.value}</option>
      </s:iterator>
    </select>

  • 相关阅读:
    Android中Services之异步IntentService(二)
    Android服务之Service(其一)
    JPA 2.0 中的动态类型安全查询
    JPA注解参考
    WebService netbeans glassfish
    android ContentProvider
    github
    移动端
    php
    mysql
  • 原文地址:https://www.cnblogs.com/htys/p/3261719.html
Copyright © 2011-2022 走看看