我想通过一个链接地址 跳到一个有下拉菜单的界面 但是下拉菜单读取不出数据;entrance.jsp 这是入口           <a href="<s:url action="addPatch" />">增量文件添加</a>
这是action的配置        <action name="addPatch" class="com.asiainfo.cmplat.actions.PatchDemandAction" method="getList">
            <result name="success">/dev_add.jsp</result>
        </action>
这是action        public class PatchDemandAction extends AbstractAction 
       {

private List<Product> productList;        public String getList()
{
try
{
setProductList(patchDemandService.getProductListService());
System.out.println(getProductList());
return "success";
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}        public List<Product> getProductList() 
{
return productList;
} public void setProductList(List<Product> productList) {
this.productList = productList;
}       }     
这是跳转页面dev_add.jsp
<s:select list="productList" listKey="productId" listValue="productName"></s:select>实体类如下: get,set方法略
public class Product implements java.io.Serializable 
{
// Fields
private Long productId;
private String productName;
        get,set方法略
}

解决方案 »

  1.   

    <s:select>表达式应该不是这样写的吧
      

  2.   

     谁能告诉我 select 标签的属性都怎么填
      

  3.   

     <s:select     name="instrument.adminInfoByUserId1.id" list="#{'2':'常钢','3':'董兵海','4':'蔡芳昌','5':'潘瑞琨','6':'辛燕','7':'杨向荣','8':'卢寅梅','9':'路国红','10':'任小明','11':'朱杰','12':'周威','13':'王今朝 ' }" listKey="key" listValue="value" value="%{instrument.adminInfoByUserId1.id}"/><s:action name="ListStudentAction" id="bean" />
    <s:select list="#bean.listMajor" name="selectmajor" id="selectmajor" listKey="mnu"
    listValue="mname" headerKey="" headerValue="--请选择专业--"
    theme="simple">
    </s:select>

    两个属性 listKey="mnu"为实际保存的值,
     listValue="mname" 为下拉菜单显示的值。以上代码均为项目中的实际源码。
      

  4.   

    <s:select要name不的,记不得了