日期:2014-05-18  浏览次数:20746 次

急求救!!STRUTS logic:iterate的bean:write问题
bean:write不能输出logic:iterate中的内容。如果去掉property.改为 <bean:write   name= "list "/> 则输出两个对象:
InfoForm@136bf67
InfoForm@1503928  

下面是部分代码。

Action:
ListForm   tssList   =   new   ListForm   ();
tssList   =   test();
request.setAttribute( "TSSList ",   tssList);

public   TSSListForm   test(){
 
ArrayList   tSSInfoListTemp   =   new   ArrayList();
ListForm   tSSList   =   new   ListForm();  
InfoForm   tSSInfo   =   new   InfoForm();  
tSSInfo   .setCabinClass(   "a ");
tSSInfoListTemp.add(tSSInfo);
InfoForm   tSSInfo1   =   new   InfoForm();  
tSSInfo1.setCabinClass(   "b ");
  tSSInfoListTemp.add(tSSInfo1);
tSSList.setList(tSSInfoListTemp);
 
return   tSSList;
}
 
JSP:
<logic:iterate   id= "list "   name= "TSSList "   >      
<bean:write   name= "list "   property= "cabinClass "/>
</logic:iterate>

form:
public   class   ListForm   extends   DynamicValidatorForm   implements   Serializable   {
private   ArrayList   list;
/**
  *  
  */
public   TSSListForm()   {
super();
}
/**
  *   @return   Returns   the   list.
  */
public   ArrayList   getList()   {
return   this.list;
}
/**
  *   @param   list   The   list   to   set.
  */
public   void   setList(ArrayList   list)   {
this.list   =   list;
}
}

public   class   InfoForm   extends   DynamicValidatorForm   implements   Serializable   {
public   String   cabinClass   =   " ";
public   String   getCabinClass()   {
return   cabinClass;
}

public   void   setCabinClass(String   cabinClass)   {
this.cabinClass   =   cabinClass;
}
}

------解决方案--------------------
给分吧