Hi,
i'm trying the append tag and the list values of the appended lists are not
showed.
This is the main part of the jsp code:
<s:append var="metalBands">
<s:param value="%{groups}"/>
<s:param value="%{groups1}"/>
</s:append>
Total Bands:<br>
<s:iterator id="band" value="%{#metalBands}">
Band:<s:property value="#band.name"/><br>
</s:iterator>
This is my Action class:
package struts2.action;
import java.util.ArrayList;
import com.opensymphony.xwork2.ActionSupport;
public class IteratorAction extends ActionSupport {
ArrayList<Band> groups=new ArrayList<Band>();
ArrayList<Band> groups1=new ArrayList<Band>();
public String greeting(){
return "Hi, Every body";
}
@Override
public String execute() throws Exception {
this.groups.add(new Band("trash","Slayer"));
this.groups.add(new Band("trash","kreator"));
this.groups.add(new Band("death","Deicide"));
this.groups.add(new Band("death","Obituary"));
this.groups1.add(new Band("heavy","Judas Priest"));
this.groups1.add(new Band("heavy","Primal Fear"));
return SUCCESS;
}
public ArrayList<Band> getGroups() {
return groups;
}
public void setGroups(ArrayList<Band> groups) {
this.groups = groups;
}
public ArrayList<Band> getGroups1() {
return groups1;
}
public void setGroups1(ArrayList<Band> groups1) {
this.groups1 = groups1;
}
}
This is my bean class:
package struts2.action;
public class Band {
private String style;
private String name;
public Band(String st,String n){
this.style=st;
this.name=n;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
This is the ouput application:
Total Bands:
Band:
Band:
Band:
Band:
Band:
Band:
As you can see there is no values showed .
Please, can you help me with this?.
Thanks in advanced!!.
I think you need a public getter for band.name:
public String getName() {
return name;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org