You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Valentin Erastov <xi...@gmail.com> on 2009/05/13 18:18:31 UTC
Zone and loop problem
Hello,
This is my simple example code,
tml:
<t:loop source="comment" value="comment" >
<t:zone t:id="commentRating">${comment.rating}</t:zone>
<t:actionlink t:id="voteUp" context="comment.id"
t:zone="commentRating">+</t:actionlink>
<t:actionlink t:id="voteDown" context="comment.id"
t:zone="commentRating">-</t:actionlink>
</t:loop>
java:
@InjectComponent
private Zone commentRating;
public Object onActionFromVoteUp(Long commentId) {
voteService.voteUp(user, commentId);
comment = commentDao.findById(commentId);
return commentRating.getBody();
}
When I click on any t:actionlink updated rating for a context comment
written in first rating "zone-div" element( which was rendered during the
first iteration )
What to do in such situations?
Re: Re[2]: Zone and loop problem
Posted by Valentin Yerastov <xi...@gmail.com>.
Thanks to all! It`s work!
Inge Solvoll wrote:
>
> This is possible, isn't it?
>
> <t:zone t:id="myZone" id="prop:currentZoneId"/>
>
> @InjectComponent
> private Zone myZone;
>
> public String getCurrentZoneId() {
> return "somethingUnique";
> }
>
> myZone will be treated like a normal component id by tapestry, and makes
> it
> possible to inject the zone in the class.
>
> On Thu, May 14, 2009 at 9:08 AM, Yury Luneff <bi...@ya.ru> wrote:
>
>> well, as for template -- it should work (not so much time need for
>> checking). as for zones injection in the page... well, i guess you
>> need to find a way of not injecting zones, there are different
>> possibilities that might work for you.
>>
>> > How can I generate dynamic ID for zone?
>> > Can I use something like:
>> > <t:loop source="comment" value="comment" >
>> > <t:zone
>> > t:id="commentRating${comment.id}">${comment.rating}</t:zone>
>>
>> > And if I do it, how can I inject it into my page?
>>
>>
>> > Yury Luneff-2 wrote:
>> >>
>> >> i guess you should make different id's for all the zones you create
>> >> dynamically.
>> >>
>> >>> Hello,
>> >>
>> >>> This is my simple example code,
>> >>
>> >>> tml:
>> >>
>> >>> <t:loop source="comment" value="comment" >
>> >>
>> >>> <t:zone t:id="commentRating">${comment.rating}</t:zone>
>> >>
>> >>> <t:actionlink t:id="voteUp" context="comment.id"
>> >>> t:zone="commentRating">+</t:actionlink>
>> >>> <t:actionlink t:id="voteDown" context="comment.id"
>> >>> t:zone="commentRating">-</t:actionlink>
>> >>
>> >>> </t:loop>
>> >>
>> >>> java:
>> >>
>> >>> @InjectComponent
>> >>> private Zone commentRating;
>> >>
>> >>> public Object onActionFromVoteUp(Long commentId) {
>> >>> voteService.voteUp(user, commentId);
>> >>> comment = commentDao.findById(commentId);
>> >>> return commentRating.getBody();
>> >>> }
>> >>
>> >>> When I click on any t:actionlink updated rating for a context comment
>> >>> written in first rating "zone-div" element( which was rendered during
>> the
>> >>> first iteration )
>> >>
>> >>> What to do in such situations?
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
--
View this message in context: http://n2.nabble.com/Zone-and-loop-problem-tp2884886p2889022.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re[4]: Zone and loop problem
Posted by Yury Luneff <bi...@ya.ru>.
thank you for the great tip :)
> This is possible, isn't it?
> <t:zone t:id="myZone" id="prop:currentZoneId"/>
> @InjectComponent
> private Zone myZone;
> public String getCurrentZoneId() {
> return "somethingUnique";
> }
> myZone will be treated like a normal component id by tapestry, and makes it
> possible to inject the zone in the class.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Re[2]: Zone and loop problem
Posted by Inge Solvoll <in...@gmail.com>.
This is possible, isn't it?
<t:zone t:id="myZone" id="prop:currentZoneId"/>
@InjectComponent
private Zone myZone;
public String getCurrentZoneId() {
return "somethingUnique";
}
myZone will be treated like a normal component id by tapestry, and makes it
possible to inject the zone in the class.
On Thu, May 14, 2009 at 9:08 AM, Yury Luneff <bi...@ya.ru> wrote:
> well, as for template -- it should work (not so much time need for
> checking). as for zones injection in the page... well, i guess you
> need to find a way of not injecting zones, there are different
> possibilities that might work for you.
>
> > How can I generate dynamic ID for zone?
> > Can I use something like:
> > <t:loop source="comment" value="comment" >
> > <t:zone
> > t:id="commentRating${comment.id}">${comment.rating}</t:zone>
>
> > And if I do it, how can I inject it into my page?
>
>
> > Yury Luneff-2 wrote:
> >>
> >> i guess you should make different id's for all the zones you create
> >> dynamically.
> >>
> >>> Hello,
> >>
> >>> This is my simple example code,
> >>
> >>> tml:
> >>
> >>> <t:loop source="comment" value="comment" >
> >>
> >>> <t:zone t:id="commentRating">${comment.rating}</t:zone>
> >>
> >>> <t:actionlink t:id="voteUp" context="comment.id"
> >>> t:zone="commentRating">+</t:actionlink>
> >>> <t:actionlink t:id="voteDown" context="comment.id"
> >>> t:zone="commentRating">-</t:actionlink>
> >>
> >>> </t:loop>
> >>
> >>> java:
> >>
> >>> @InjectComponent
> >>> private Zone commentRating;
> >>
> >>> public Object onActionFromVoteUp(Long commentId) {
> >>> voteService.voteUp(user, commentId);
> >>> comment = commentDao.findById(commentId);
> >>> return commentRating.getBody();
> >>> }
> >>
> >>> When I click on any t:actionlink updated rating for a context comment
> >>> written in first rating "zone-div" element( which was rendered during
> the
> >>> first iteration )
> >>
> >>> What to do in such situations?
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re[2]: Zone and loop problem
Posted by Yury Luneff <bi...@ya.ru>.
well, as for template -- it should work (not so much time need for
checking). as for zones injection in the page... well, i guess you
need to find a way of not injecting zones, there are different
possibilities that might work for you.
> How can I generate dynamic ID for zone?
> Can I use something like:
> <t:loop source="comment" value="comment" >
> <t:zone
> t:id="commentRating${comment.id}">${comment.rating}</t:zone>
> And if I do it, how can I inject it into my page?
> Yury Luneff-2 wrote:
>>
>> i guess you should make different id's for all the zones you create
>> dynamically.
>>
>>> Hello,
>>
>>> This is my simple example code,
>>
>>> tml:
>>
>>> <t:loop source="comment" value="comment" >
>>
>>> <t:zone t:id="commentRating">${comment.rating}</t:zone>
>>
>>> <t:actionlink t:id="voteUp" context="comment.id"
>>> t:zone="commentRating">+</t:actionlink>
>>> <t:actionlink t:id="voteDown" context="comment.id"
>>> t:zone="commentRating">-</t:actionlink>
>>
>>> </t:loop>
>>
>>> java:
>>
>>> @InjectComponent
>>> private Zone commentRating;
>>
>>> public Object onActionFromVoteUp(Long commentId) {
>>> voteService.voteUp(user, commentId);
>>> comment = commentDao.findById(commentId);
>>> return commentRating.getBody();
>>> }
>>
>>> When I click on any t:actionlink updated rating for a context comment
>>> written in first rating "zone-div" element( which was rendered during the
>>> first iteration )
>>
>>> What to do in such situations?
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone and loop problem
Posted by Valentin Yerastov <xi...@gmail.com>.
How can I generate dynamic ID for zone?
Can I use something like:
<t:loop source="comment" value="comment" >
<t:zone t:id="commentRating${comment.id}">${comment.rating}</t:zone>
And if I do it, how can I inject it into my page?
Yury Luneff-2 wrote:
>
> i guess you should make different id's for all the zones you create
> dynamically.
>
>> Hello,
>
>> This is my simple example code,
>
>> tml:
>
>> <t:loop source="comment" value="comment" >
>
>> <t:zone t:id="commentRating">${comment.rating}</t:zone>
>
>> <t:actionlink t:id="voteUp" context="comment.id"
>> t:zone="commentRating">+</t:actionlink>
>> <t:actionlink t:id="voteDown" context="comment.id"
>> t:zone="commentRating">-</t:actionlink>
>
>> </t:loop>
>
>> java:
>
>> @InjectComponent
>> private Zone commentRating;
>
>> public Object onActionFromVoteUp(Long commentId) {
>> voteService.voteUp(user, commentId);
>> comment = commentDao.findById(commentId);
>> return commentRating.getBody();
>> }
>
>> When I click on any t:actionlink updated rating for a context comment
>> written in first rating "zone-div" element( which was rendered during the
>> first iteration )
>
>> What to do in such situations?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://n2.nabble.com/Zone-and-loop-problem-tp2884886p2887948.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Zone and loop problem
Posted by Yury Luneff <bi...@ya.ru>.
i guess you should make different id's for all the zones you create
dynamically.
> Hello,
> This is my simple example code,
> tml:
> <t:loop source="comment" value="comment" >
> <t:zone t:id="commentRating">${comment.rating}</t:zone>
> <t:actionlink t:id="voteUp" context="comment.id"
> t:zone="commentRating">+</t:actionlink>
> <t:actionlink t:id="voteDown" context="comment.id"
> t:zone="commentRating">-</t:actionlink>
> </t:loop>
> java:
> @InjectComponent
> private Zone commentRating;
> public Object onActionFromVoteUp(Long commentId) {
> voteService.voteUp(user, commentId);
> comment = commentDao.findById(commentId);
> return commentRating.getBody();
> }
> When I click on any t:actionlink updated rating for a context comment
> written in first rating "zone-div" element( which was rendered during the
> first iteration )
> What to do in such situations?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org