Hello all,

I have a Action contain a list List<adminTitleVO>, and a String property
titleID, how to display the value from list?
Detail code is here:
//**************IndexAction******
public class IndexAction{
private List<AdminTitleVO> list;
private String titleID;
//get & set ....
  public String viewPage()
  {

  //#{'a1':'admin','a2':'manager','a3':'member','a4':'user','a5':'guest'}//
simple data list
      this.list = BS.getAdminTitleList();
     //set a id
      this.titleID = "a5";
      return "view";
  }
}

//**************AdminTitle******
public class AdminTitle{
  private String id;
  private String name;
// get & set ...
}

//**************JSP page******
<s:select list="list" listKey="id" listValue="name" value="a4"/>, 'user'
item will be selected.
Now, I want to display the name in plain text way! Get the name by titleID
in the Action
${list[0].name}, I can get first item from List, and display the name=
'admin';
but
${list[titleID].name} is showing Error on page.
How can I get the "adminTitle.name" on the page, by the certain
"adminTitle.id"

The following code run fine.
<s:iterator value="list.{?#this.id == 'a4'}">
      <s:property value="name" /> :<s:property value="id" />
</s:iterator>
but
<s:iterator value="list.{?#this.id == titleID'}">
      <s:property value="name" /> :<s:property value="id" />
</s:iterator>
it show nothing...
What shall I do to pass the "this.titleID" in the Action into the struts2


Regards,
Mead

Reply via email to