tks for your quick response. the reason i initialize there is because try to get fresh list from database. second, as your suggest, i need to change the name, but how? tks in advance again john
--- On Fri, 4/10/09, Wes Wannemacher <w...@wantii.com> wrote: From: Wes Wannemacher <w...@wantii.com> Subject: Re: <s:checkboxlist or <s:checkbox To: "Struts Users Mailing List" <user@struts.apache.org> Date: Friday, April 10, 2009, 1:09 AM I'm jumping in a bit late, but I'll add a few observations. I don't think that execute is the place where you want to initialize your service and populate the "beds" list... You're better off implementing Preparable and initializing the list there. Second, when you are using the iterator and creating single checkboxes, you need to make the names unique. You are simply creating a new checkbox with the name "beds" over and over again. -Wes On Friday 10 April 2009 01:59:42 john lee wrote: > I defined an entity java. > > public class Bed { > private String bed_id; > public String getBed_id() {return bed_id;} > public void setBed_id(String bed_id) { this.bed_id=bed_id; } > } > > in action file, i did the following, > public class Analysis_input extends ActionSupport { > private ArrayList<Bed> beds; > public String execute() throws Exception { > ......../ * initialized service...and it is database > connection */ beds=service.Beds(); > ActionContext.getContext().getSession().put("Beds",beds); > return SUCCESS; > } > public void setBeds(ArrayList<Bed> beds){ this.beds = beds; } > public ArrayList<Bed> getBeds() { return beds; } > } > > in jsp file, i did > <s:checkboxlist name="beds" list="beds" /> > > but received the error > > FreeMarker template error! > Error on line 28, column 13 in template/simple/checkboxlist.ftl > stack.findValue(parameters.listKey) is undefined. > It cannot be assigned to itemKey > The problematic instruction: > ==> assignment: itemKey=stack.findValue(parameters.listKey) [on line 28, > column 13 in template/simple/checkboxlist.ftl] in user-directive s.iterator > [on line 25, column 5 in template/simple/checkboxlist.ftl] in include > "/${parameters.templateDir}/simple/checkboxlist.ftl" [on line 25, column 1 > in template/xhtml/checkboxlist.ftl] > if i change the jsp file to the following > > <s:iterator value="beds" status="st"> > <s:checkbox name="beds" value="bed_id"></s:checkbox><br> > </s:iterator> > > but receive the new error > > <!--StartFragment-->Error on line 28, column 13 in > template/simple/checkboxlist.ftl stack.findValue(parameters.listKey) is > undefined. > It cannot be assigned to itemKey > The problematic instruction: > ---------- > ==> assignment: itemKey=stack.findValue(parameters.listKey) [on line 28, > column 13 in template/simple/checkboxlist.ftl] in user-directive s.iterator > [on line 25, column 5 in template/simple/checkboxlist.ftl] in include > "/${parameters.templateDir}/simple/checkboxlist.ftl" [on line 25, column 1 > in template/xhtml/checkboxlistany expert can give me the advise? i am new > to struts 2tks in advancejohn -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org