When activated during an AJAX request, the component has no state. In onSuccessFromKomentar(int materijalID) you should probably set this.materijalID.
On 05/12/2012, at 8:39 PM, dodjavola wrote: > Hey folks :) > I have another big issue. I have component, with zone, and form that > refreshes the zone. When I put component inside loop, it shows only last > zone. I generated unique ID for every zone. In page source, I can see that > every zone get's right ID, but it doesn't return right on submit. Is there > anyway to return zone by id? > > Here is my code: > > <details> > <summary>Comments</summary><br /> > <t:zone t:id="commentZone" id="prop:zoneId"> > <t:commentlist > materijalID="materijalID"></t:commentlist><br /> > </t:zone> > <t:form t:id="komentar" t:context="materijalID" t:zone="prop:zoneId"> > <t:textarea t:value="comment" rows="6" > cols="40"></t:textarea><br /> > <input type="submit" value="Add comment"/> > </t:form> > </details> > > public class Comments > { > @Parameter(required=true) > @Property > private int materijalID; > > @SessionState > @Property > private User user; > > @Inject > private Session session; > > @Property > private String comment; > > @InjectComponent > private Zone commentZone; > > @CommitAfter > public Object onSuccessFromKomentar(int materijalID) > { > Komentar k = new Komentar(); > Date d = new Date(); > Materijal m = > (Materijal)session.createCriteria(Materijal.class).add(Restrictions.eq("materijalID", > materijalID)).list().get(0); > k.setMaterijal(m); > k.setKorisnikID(this.user.getID()); > k.setDatumUnosa(d); > k.setDatumModifikacije(d); > k.setKomentar(this.comment); > session.save(k); > this.comment = ""; > return this.commentZone.getBody(); > } > > public String getZoneId() > { > return "Zone_" + this.materijalID; > } > } > > Thanks in advance > > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Zone-inside-loop-problem-tp5718497.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org