我想通过一个链接地址 跳到一个有下拉菜单的界面 但是下拉菜单读取不出数据;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方法略
}
这是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方法略
}
解决方案 »
- map的键被覆盖了!
- javascription 页面跳转
- HashMap存入的list怎么取出来
- Action中request.setAttribute()方法提交的参数在JSP中无法获得
- 大侠门,请亮剑吧!吗呀!一个奇怪的问题Runtime.getRuntime().exec
- struts标签<html:text>没有ID和NAME属性,如何定位到这个控件?
- EJB的server和client分别在两个不同的机器上,用RMI访问速度其慢,怎么提高效率阿??
- 『求助』请问怎样写BMP的主键类????
- 请教高手关于 weblogic + Jbuilder性能优化的问题
- 在JAVA中是否可以调用PB写的DLL
- url参数传递 个别中文字乱码
- struts2中<form>标签使用
<s:select list="#bean.listMajor" name="selectmajor" id="selectmajor" listKey="mnu"
listValue="mname" headerKey="" headerValue="--请选择专业--"
theme="simple">
</s:select>
两个属性 listKey="mnu"为实际保存的值,
listValue="mname" 为下拉菜单显示的值。以上代码均为项目中的实际源码。