>> <s:iterator value="list.{?#this.id == titleID'}"> Is there an unnecessary quotation mark after [titleID]? Try delete it and see if works.
If it still not working, My suggestion is: (1)you can implement the search logic in the method [viewPage], and access the search result via a new property. or (2)use a Map instead of a List, so you can retrieve the value by the key or (3)in your action class, add a new [Object Indexed Property] which retrieve the value from your list by the titleID see: http://www.opensymphony.com/ognl/html/LanguageGuide/indexing.html#N101C5 2010/11/9 Mead Lai <laiqi...@gmail.com>: > 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 > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org