Can some tapestry savvy guys look at this and help us out here. Would really appreciate the effort. This is quite a big blocker for me at present. Thanks, Srini.
On 11/10/06, Srinivas Yermal <[EMAIL PROTECTED]> wrote:
BTW We currently use version 4.0.2. and run it on tomcat. I would also appreciate if somebody can point me to the "rewind" document if any. I have heard so many stories about common newbie rewind mistakes but couldnt find what they really are. Thanks again. Srini. On 11/10/06, Srinivas Yermal <[EMAIL PROTECTED]> wrote: > > Hi, > > I am a newbie trying to learn Tapestry. I did try to search through the > archives for a solution, but couldnt find anything relavant. It would be > great if someone could point me in the right direction. > > I have a page with a listing of a collection. I am using "For" component > (ForBean) in the form. There are text fields against each item which has a > value from the items in the collection. Now one can change the text value > and hit the save button at the end of the form. The listener that is > associated with the form gets called but I dont have a clue as to how I can > obtain the changed values from the collection. I tried with both form > listener and submit action listener. I always end up with a null or empty > item collection. > > Some code snippet below - > > public abstract Collection getItems(); > public abstract void setItems(Collection items); > > ActionListener Method 1: > public void saveHistory(IRequestCycle cycle, Object[] list) { > LOG.debug("saveHistory(cycle, array) invoked"); > if (null == list) return; > for (Object o : list) { > Question mh = (Question)o; > LOG.debug(mh.getQuestionText() + " " + mh.getAnswerText()); > } > } > > ActionListener Method 2: > public void saveHistory(IRequestCycle cycle) { > LOG.debug("saveHistory(cycle, array) invoked"); > List list = cycle.getListenerParameters(); > if (null == list) return; > for (Object o : list) { > Question mh = (Question)o; > LOG.debug(mh.getQuestionText() + " " + mh.getAnswerText()); > } > } > > > FormListner Method: > public void saveFormHistory(IRequestCycle cycle) { > LOG.debug("saveFormHistory(cyle) invoked"); > Collection<Question> list = getItems(); > if (null == list) return; > for (Question mh: list) { > LOG.debug(mh.getQuestionText () + " " + mh.getAnswerText()); > } > } > > The HTML file - > > <form jwcid="[EMAIL PROTECTED]" listener="listener:saveFormHistory"> > ... > <tr jwcid="@For" source="ognl:items" value="ognl:item" element="tr"> > > > <td><span jwcid="@Insert" value="ognl:item.question.text">Question Text</span></td> > <td><input jwcid="@TextField" value="ognl:item.answerText > "/></td> > > </tr> > ... > <input class="button" type="submit" value="Save" name="save" jwcid="@Submit" action="listener:saveHistory" > > parameters="ognl:items"/> > > Please do let me know if something here is not right or if you have any > further questions. Looking forward for some advice. > > Thanks in advance. > Regards, > Srini. >
-- http://www.indygosoft.com