You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Matt Larson <sw...@ldnet.org> on 2007/04/08 21:25:08 UTC
Tap 4.1.1 problem: async direct link returns empty ajax response
I have just run into a problem that I think is probably a bug, but may
be something that I am doing wrong. It's definitely a showstopper in my
app, though.
I have a component that allows users to rate something via the normal
kind of "stars" rating. After a user clicks a star the overall rating
of the object is calculated and displayed as a graphic. I use a
component that employs an asynchronous DirectLink to do this, with each
star having a different value on submit, and it works quite nicely. I
have this custom component on two different pages and I can submit
ratings on both.
However, I just added pagination, and as soon as you move off of the
home page via the "next" pagination link, the DirectLink for ratings no
longer returns anything. The pagination works using the standard kind of
"start from" parameter, which calls a listener that simply does
setStartFrom(int startFrom) and then lets the pageBeginRender() method
calculate the objects to display.
I do know the reason that the ratings no longer show the updated
graphic--the AjaxResponse just returns empty tags, with no errors
reported at all (had a look at this with firebug):
<ajax-response></ajax-response>
The actual link is firing just fine, and all of the server side
processing happens as my logs show. It's just that the ajax response is
empty when it should include new HTML for the <div>s to be updated. It
seems like there is some kind of setup that happens when you go directly
to Home.html and click the rating link, but not when I've gone to the
home page via a DirectLink. I cannot see what would be different, since
my pageBeginRender() method is called, and everything else happens just
like it should in the component and in the page.
If anyone has run into this before or has an idea regarding what this
might cause an async DirectLink to return nothing in some cases, please
let me know. The pagination is a major part of my app, and users need
to be able to submit ratings no matter which page they are on, so I am
kind of dead in the water until I get this fixed. Next step is to spend
quality time with the source code, but if anyone has a better idea
before I take that time...
Cheers,
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tap 4.1.1 problem: async direct link returns empty ajax response
Posted by Matt Larson <sw...@ldnet.org>.
Sorry for the long interval on this discussion--needed time to try to
understand this problem a bit more. I am wondering if Jesse or anyone
else can shed a little more light on the empty ajax response problem I
am having, which is a showstopper for my app.
Using the example below (<div jwcid="div1@Any" >) did not work to add
the "div1" component to the list of components returned by
getPage().getComponents(), which is why the
"page.components.div1.clientId" expression fails. What I found was that
@Any components are not added to the component list if they are inside
components themselves. If I put an @Any component on the main container
page with an ID, it showed up in the page.components list, but not if it
was within my component.
So I guess the question is, is there a way to get the <div
jwcid="div1@Any" > component to show up in the page.components list? And
if it did show up there, would it be found in the list that is returned
by the _cycle.renderStackIterator() in the DojoAjaxResponseBuilder class
that I think is doing this work? I see that the method
boolean contains(IComponent target, String id)
looks through the list returned by renderStackIterator() to try and find
a matching clientId, so I guess that is what is failing in my case.
Also, I am still wondering why this works so nicely when I go directly
to the containing page (it's my Home page) but not if I use a DirectLink
with a listener to update some values in my Home page and then rerender
it? Is there a call I can make to ensure that the Home page thinks it
was called as Home.html rather than through a DirectLink? I think it
needs to do some kind of setup that it doesn't do via a DirectLink.
Thanks for the help,
Matt
PS. Some named components within other components did show up in the
page.components list, such as a @For component I used in my .jwc file to
see the page.components list:
<component id="listComponents" type="For">
<binding name="source" value="ognl:page.components.keySet()"/>
<binding name="value" value="ognl:myComponent"/>
</component>
Searching through the list archives a bit, I saw a few suggestions that
this was related to the fact that @For extends the FormComponent class,
which sounded plausible but I did not experiment with this enough to
confirm.
Jesse Kuhnert wrote:
> No things should still work the same with 4.1.1. .(but upgrading might
> be a good idea either way)
>
> The error you got means that you don't have a component defined in
> your page with an id of "div1". Your example before on how you were
> defining your div blocks was incorrect and I provided an example of
> how to do it...ie :
>
> <div jwcid="div1@Any" >
>
> It'll work if you define your block that way.
>
> On 4/10/07, Matt Larson <sw...@ldnet.org> wrote:
>> Hi Jesse,
>>
>> I did try this approach previously, thinking OGNL would use the Map key
>> as a property like in your example (I think that's what it's doing in
>> your example?). But following your example very closely, I get this
>> exception:
>>
>> Unable to read OGNL expression...source is null for getProperty(null,
>> "clientId")
>>
>> (source is
>> updateComponents="ognl:{page.components.div1.clientId,page.components.div2.clientId}")
>>
>>
>> I think was partly the cause of my confusion before :). I couldn't see
>> how that expression could work, and it appears to be dying at the
>> div1/div2 step.
>>
>> Now I'm suspecting I need to upgrade to the latest Tap 4.x source and
>> the latest OGNL, which I know you have done a lot of work on. Do I need
>> those to make your example work?
>>
>> Thanks again,
>> Matt
>>
>> Jesse Kuhnert wrote:
>> > You want to do something like this instead for your divs:
>> >
>> > <div jwcid="foo@Any" >
>> >
>> > Then your updateComponents statement becomes
>> >
>> >
>> updateComponents="ognl:{page.components.foo.clientId,page.components.someOtherDiv.clientId}"
>>
>> >
>> >
>> > On 4/10/07, Matt Larson <sw...@ldnet.org> wrote:
>> >> Jesse,
>> >>
>> >> Thanks for your response. This feels like the problem, that the
>> IDs on
>> >> the <div> tags are not being matched. However due to my lack of
>> >> knowledge about Tapestry's internals, I haven't been able to
>> implement
>> >> your suggestion.
>> >>
>> >> What I can't figure out is how to get the clientId out of the OGNL
>> >> expression you used (page.components.div1.clientId). I had a look at
>> >> what is in the Map that page.components returns, and I don't see
>> >> anything that looks like my components' clientIds in either the
>> >> component.getClientId() or in the set of keys of the components Map.
>> >> How do I get the clientId from a component named "div1", given
>> that I'm
>> >> in a For loop as well? I'm confused about what the updateComponents
>> >> parameter in the DirectLink component should take instead of the
>> IDs on
>> >> the <div>s since I can't seem to retrieve the clientIds.
>> >>
>> >> Here is what I am doing now, using components with IDs to try to
>> follow
>> >> your example:
>> >>
>> >> In the .jwc file I have two components for <div>s that look like
>> this:
>> >>
>> >> <component id="div1" type="Any">
>> >> <binding name="id" value="ognl:'ratingStars' + hunch.id"/>
>> >> </component>
>> >>
>> >> <component id="div2" type="Any">
>> >> <binding name="id" value="ognl:'ratingImage' + hunch.id"/>
>> >> </component>
>> >>
>> >> These are used to display the <div>s in the .html file, which will be
>> >> updated by the asynchronous DirectLink.
>> >>
>> >> Then in my DirectLink component:
>> >>
>> >> <a jwcid="@DirectLink"
>> >> listener="listener:submitRatingAjax"
>> >> async="ognl:true"
>> >> updateComponents="ognl:{'ratingImage' +
>> >> hunch.id,'ratingStars' + hunch.id}">...</a>
>> >>
>> >> If you or anyone else can help direct me to the right way to get the
>> >> clientIds for components for use within the updateComponents
>> parameter,
>> >> that would be greatly appreciated. I have looked at the source
>> code and
>> >> APIs but so far that hasn't cleared it up.
>> >>
>> >> Cheers,
>> >> Matt
>> >>
>> >> Jesse Kuhnert wrote:
>> >> > Hmm... You can try adding some of the server side logging stuff
>> >> > outlined here:
>> >> http://tapestry.apache.org/tapestry4.1/ajax/debugging.html
>> >> > .
>> >> >
>> >> > I'm guessing that the clientId of the div's you are trying to
>> update
>> >> > doesn't match on these responses.
>> >> >
>> >> > One thing you could do as a test is if you currently do something
>> >> like:
>> >> >
>> >> > <a jwcid="@DirectLink" updateComponents="div1,div2"
>> >> >
>> >> > change it to :
>> >> >
>> >> > <a jwcid="@DirectLink"
>> >> > updateComponents="ognl:{page.components.div1.clientId,
>> >> > page.components.div2.clientId}"
>> >> >
>> >> > I noticed something similar to this recently and probably need
>> to make
>> >> > updateComponents="a,b" automatically use the clientId and not
>> >> > componentId to match id's on the response.
>> >> >
>> >> > Hopefully that's the problem.
>> >> >
>> >> > On 4/8/07, Matt Larson <sw...@ldnet.org> wrote:
>> >> >> I have just run into a problem that I think is probably a bug, but
>> >> may
>> >> >> be something that I am doing wrong. It's definitely a showstopper
>> >> in my
>> >> >> app, though.
>> >> >>
>> >> >> I have a component that allows users to rate something via the
>> normal
>> >> >> kind of "stars" rating. After a user clicks a star the overall
>> >> rating
>> >> >> of the object is calculated and displayed as a graphic. I use a
>> >> >> component that employs an asynchronous DirectLink to do this, with
>> >> each
>> >> >> star having a different value on submit, and it works quite
>> >> nicely. I
>> >> >> have this custom component on two different pages and I can submit
>> >> >> ratings on both.
>> >> >>
>> >> >> However, I just added pagination, and as soon as you move off
>> of the
>> >> >> home page via the "next" pagination link, the DirectLink for
>> >> ratings no
>> >> >> longer returns anything. The pagination works using the standard
>> >> kind of
>> >> >> "start from" parameter, which calls a listener that simply does
>> >> >> setStartFrom(int startFrom) and then lets the pageBeginRender()
>> >> method
>> >> >> calculate the objects to display.
>> >> >>
>> >> >> I do know the reason that the ratings no longer show the updated
>> >> >> graphic--the AjaxResponse just returns empty tags, with no errors
>> >> >> reported at all (had a look at this with firebug):
>> >> >>
>> >> >> <ajax-response></ajax-response>
>> >> >>
>> >> >> The actual link is firing just fine, and all of the server side
>> >> >> processing happens as my logs show. It's just that the ajax
>> >> response is
>> >> >> empty when it should include new HTML for the <div>s to be
>> >> updated. It
>> >> >> seems like there is some kind of setup that happens when you go
>> >> directly
>> >> >> to Home.html and click the rating link, but not when I've gone
>> to the
>> >> >> home page via a DirectLink. I cannot see what would be different,
>> >> since
>> >> >> my pageBeginRender() method is called, and everything else happens
>> >> just
>> >> >> like it should in the component and in the page.
>> >> >>
>> >> >> If anyone has run into this before or has an idea regarding
>> what this
>> >> >> might cause an async DirectLink to return nothing in some cases,
>> >> please
>> >> >> let me know. The pagination is a major part of my app, and users
>> >> need
>> >> >> to be able to submit ratings no matter which page they are on, so
>> >> I am
>> >> >> kind of dead in the water until I get this fixed. Next step is to
>> >> spend
>> >> >> quality time with the source code, but if anyone has a better idea
>> >> >> before I take that time...
>> >> >>
>> >> >> Cheers,
>> >> >> Matt
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> 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
>> >>
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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: Tap 4.1.1 problem: async direct link returns empty ajax response
Posted by Jesse Kuhnert <jk...@gmail.com>.
No things should still work the same with 4.1.1. .(but upgrading might
be a good idea either way)
The error you got means that you don't have a component defined in
your page with an id of "div1". Your example before on how you were
defining your div blocks was incorrect and I provided an example of
how to do it...ie :
<div jwcid="div1@Any" >
It'll work if you define your block that way.
On 4/10/07, Matt Larson <sw...@ldnet.org> wrote:
> Hi Jesse,
>
> I did try this approach previously, thinking OGNL would use the Map key
> as a property like in your example (I think that's what it's doing in
> your example?). But following your example very closely, I get this
> exception:
>
> Unable to read OGNL expression...source is null for getProperty(null,
> "clientId")
>
> (source is
> updateComponents="ognl:{page.components.div1.clientId,page.components.div2.clientId}")
>
> I think was partly the cause of my confusion before :). I couldn't see
> how that expression could work, and it appears to be dying at the
> div1/div2 step.
>
> Now I'm suspecting I need to upgrade to the latest Tap 4.x source and
> the latest OGNL, which I know you have done a lot of work on. Do I need
> those to make your example work?
>
> Thanks again,
> Matt
>
> Jesse Kuhnert wrote:
> > You want to do something like this instead for your divs:
> >
> > <div jwcid="foo@Any" >
> >
> > Then your updateComponents statement becomes
> >
> > updateComponents="ognl:{page.components.foo.clientId,page.components.someOtherDiv.clientId}"
> >
> >
> > On 4/10/07, Matt Larson <sw...@ldnet.org> wrote:
> >> Jesse,
> >>
> >> Thanks for your response. This feels like the problem, that the IDs on
> >> the <div> tags are not being matched. However due to my lack of
> >> knowledge about Tapestry's internals, I haven't been able to implement
> >> your suggestion.
> >>
> >> What I can't figure out is how to get the clientId out of the OGNL
> >> expression you used (page.components.div1.clientId). I had a look at
> >> what is in the Map that page.components returns, and I don't see
> >> anything that looks like my components' clientIds in either the
> >> component.getClientId() or in the set of keys of the components Map.
> >> How do I get the clientId from a component named "div1", given that I'm
> >> in a For loop as well? I'm confused about what the updateComponents
> >> parameter in the DirectLink component should take instead of the IDs on
> >> the <div>s since I can't seem to retrieve the clientIds.
> >>
> >> Here is what I am doing now, using components with IDs to try to follow
> >> your example:
> >>
> >> In the .jwc file I have two components for <div>s that look like this:
> >>
> >> <component id="div1" type="Any">
> >> <binding name="id" value="ognl:'ratingStars' + hunch.id"/>
> >> </component>
> >>
> >> <component id="div2" type="Any">
> >> <binding name="id" value="ognl:'ratingImage' + hunch.id"/>
> >> </component>
> >>
> >> These are used to display the <div>s in the .html file, which will be
> >> updated by the asynchronous DirectLink.
> >>
> >> Then in my DirectLink component:
> >>
> >> <a jwcid="@DirectLink"
> >> listener="listener:submitRatingAjax"
> >> async="ognl:true"
> >> updateComponents="ognl:{'ratingImage' +
> >> hunch.id,'ratingStars' + hunch.id}">...</a>
> >>
> >> If you or anyone else can help direct me to the right way to get the
> >> clientIds for components for use within the updateComponents parameter,
> >> that would be greatly appreciated. I have looked at the source code and
> >> APIs but so far that hasn't cleared it up.
> >>
> >> Cheers,
> >> Matt
> >>
> >> Jesse Kuhnert wrote:
> >> > Hmm... You can try adding some of the server side logging stuff
> >> > outlined here:
> >> http://tapestry.apache.org/tapestry4.1/ajax/debugging.html
> >> > .
> >> >
> >> > I'm guessing that the clientId of the div's you are trying to update
> >> > doesn't match on these responses.
> >> >
> >> > One thing you could do as a test is if you currently do something
> >> like:
> >> >
> >> > <a jwcid="@DirectLink" updateComponents="div1,div2"
> >> >
> >> > change it to :
> >> >
> >> > <a jwcid="@DirectLink"
> >> > updateComponents="ognl:{page.components.div1.clientId,
> >> > page.components.div2.clientId}"
> >> >
> >> > I noticed something similar to this recently and probably need to make
> >> > updateComponents="a,b" automatically use the clientId and not
> >> > componentId to match id's on the response.
> >> >
> >> > Hopefully that's the problem.
> >> >
> >> > On 4/8/07, Matt Larson <sw...@ldnet.org> wrote:
> >> >> I have just run into a problem that I think is probably a bug, but
> >> may
> >> >> be something that I am doing wrong. It's definitely a showstopper
> >> in my
> >> >> app, though.
> >> >>
> >> >> I have a component that allows users to rate something via the normal
> >> >> kind of "stars" rating. After a user clicks a star the overall
> >> rating
> >> >> of the object is calculated and displayed as a graphic. I use a
> >> >> component that employs an asynchronous DirectLink to do this, with
> >> each
> >> >> star having a different value on submit, and it works quite
> >> nicely. I
> >> >> have this custom component on two different pages and I can submit
> >> >> ratings on both.
> >> >>
> >> >> However, I just added pagination, and as soon as you move off of the
> >> >> home page via the "next" pagination link, the DirectLink for
> >> ratings no
> >> >> longer returns anything. The pagination works using the standard
> >> kind of
> >> >> "start from" parameter, which calls a listener that simply does
> >> >> setStartFrom(int startFrom) and then lets the pageBeginRender()
> >> method
> >> >> calculate the objects to display.
> >> >>
> >> >> I do know the reason that the ratings no longer show the updated
> >> >> graphic--the AjaxResponse just returns empty tags, with no errors
> >> >> reported at all (had a look at this with firebug):
> >> >>
> >> >> <ajax-response></ajax-response>
> >> >>
> >> >> The actual link is firing just fine, and all of the server side
> >> >> processing happens as my logs show. It's just that the ajax
> >> response is
> >> >> empty when it should include new HTML for the <div>s to be
> >> updated. It
> >> >> seems like there is some kind of setup that happens when you go
> >> directly
> >> >> to Home.html and click the rating link, but not when I've gone to the
> >> >> home page via a DirectLink. I cannot see what would be different,
> >> since
> >> >> my pageBeginRender() method is called, and everything else happens
> >> just
> >> >> like it should in the component and in the page.
> >> >>
> >> >> If anyone has run into this before or has an idea regarding what this
> >> >> might cause an async DirectLink to return nothing in some cases,
> >> please
> >> >> let me know. The pagination is a major part of my app, and users
> >> need
> >> >> to be able to submit ratings no matter which page they are on, so
> >> I am
> >> >> kind of dead in the water until I get this fixed. Next step is to
> >> spend
> >> >> quality time with the source code, but if anyone has a better idea
> >> >> before I take that time...
> >> >>
> >> >> Cheers,
> >> >> Matt
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> 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
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tap 4.1.1 problem: async direct link returns empty ajax response
Posted by Matt Larson <sw...@ldnet.org>.
Hi Jesse,
I did try this approach previously, thinking OGNL would use the Map key
as a property like in your example (I think that's what it's doing in
your example?). But following your example very closely, I get this
exception:
Unable to read OGNL expression...source is null for getProperty(null,
"clientId")
(source is
updateComponents="ognl:{page.components.div1.clientId,page.components.div2.clientId}")
I think was partly the cause of my confusion before :). I couldn't see
how that expression could work, and it appears to be dying at the
div1/div2 step.
Now I'm suspecting I need to upgrade to the latest Tap 4.x source and
the latest OGNL, which I know you have done a lot of work on. Do I need
those to make your example work?
Thanks again,
Matt
Jesse Kuhnert wrote:
> You want to do something like this instead for your divs:
>
> <div jwcid="foo@Any" >
>
> Then your updateComponents statement becomes
>
> updateComponents="ognl:{page.components.foo.clientId,page.components.someOtherDiv.clientId}"
>
>
> On 4/10/07, Matt Larson <sw...@ldnet.org> wrote:
>> Jesse,
>>
>> Thanks for your response. This feels like the problem, that the IDs on
>> the <div> tags are not being matched. However due to my lack of
>> knowledge about Tapestry's internals, I haven't been able to implement
>> your suggestion.
>>
>> What I can't figure out is how to get the clientId out of the OGNL
>> expression you used (page.components.div1.clientId). I had a look at
>> what is in the Map that page.components returns, and I don't see
>> anything that looks like my components' clientIds in either the
>> component.getClientId() or in the set of keys of the components Map.
>> How do I get the clientId from a component named "div1", given that I'm
>> in a For loop as well? I'm confused about what the updateComponents
>> parameter in the DirectLink component should take instead of the IDs on
>> the <div>s since I can't seem to retrieve the clientIds.
>>
>> Here is what I am doing now, using components with IDs to try to follow
>> your example:
>>
>> In the .jwc file I have two components for <div>s that look like this:
>>
>> <component id="div1" type="Any">
>> <binding name="id" value="ognl:'ratingStars' + hunch.id"/>
>> </component>
>>
>> <component id="div2" type="Any">
>> <binding name="id" value="ognl:'ratingImage' + hunch.id"/>
>> </component>
>>
>> These are used to display the <div>s in the .html file, which will be
>> updated by the asynchronous DirectLink.
>>
>> Then in my DirectLink component:
>>
>> <a jwcid="@DirectLink"
>> listener="listener:submitRatingAjax"
>> async="ognl:true"
>> updateComponents="ognl:{'ratingImage' +
>> hunch.id,'ratingStars' + hunch.id}">...</a>
>>
>> If you or anyone else can help direct me to the right way to get the
>> clientIds for components for use within the updateComponents parameter,
>> that would be greatly appreciated. I have looked at the source code and
>> APIs but so far that hasn't cleared it up.
>>
>> Cheers,
>> Matt
>>
>> Jesse Kuhnert wrote:
>> > Hmm... You can try adding some of the server side logging stuff
>> > outlined here:
>> http://tapestry.apache.org/tapestry4.1/ajax/debugging.html
>> > .
>> >
>> > I'm guessing that the clientId of the div's you are trying to update
>> > doesn't match on these responses.
>> >
>> > One thing you could do as a test is if you currently do something
>> like:
>> >
>> > <a jwcid="@DirectLink" updateComponents="div1,div2"
>> >
>> > change it to :
>> >
>> > <a jwcid="@DirectLink"
>> > updateComponents="ognl:{page.components.div1.clientId,
>> > page.components.div2.clientId}"
>> >
>> > I noticed something similar to this recently and probably need to make
>> > updateComponents="a,b" automatically use the clientId and not
>> > componentId to match id's on the response.
>> >
>> > Hopefully that's the problem.
>> >
>> > On 4/8/07, Matt Larson <sw...@ldnet.org> wrote:
>> >> I have just run into a problem that I think is probably a bug, but
>> may
>> >> be something that I am doing wrong. It's definitely a showstopper
>> in my
>> >> app, though.
>> >>
>> >> I have a component that allows users to rate something via the normal
>> >> kind of "stars" rating. After a user clicks a star the overall
>> rating
>> >> of the object is calculated and displayed as a graphic. I use a
>> >> component that employs an asynchronous DirectLink to do this, with
>> each
>> >> star having a different value on submit, and it works quite
>> nicely. I
>> >> have this custom component on two different pages and I can submit
>> >> ratings on both.
>> >>
>> >> However, I just added pagination, and as soon as you move off of the
>> >> home page via the "next" pagination link, the DirectLink for
>> ratings no
>> >> longer returns anything. The pagination works using the standard
>> kind of
>> >> "start from" parameter, which calls a listener that simply does
>> >> setStartFrom(int startFrom) and then lets the pageBeginRender()
>> method
>> >> calculate the objects to display.
>> >>
>> >> I do know the reason that the ratings no longer show the updated
>> >> graphic--the AjaxResponse just returns empty tags, with no errors
>> >> reported at all (had a look at this with firebug):
>> >>
>> >> <ajax-response></ajax-response>
>> >>
>> >> The actual link is firing just fine, and all of the server side
>> >> processing happens as my logs show. It's just that the ajax
>> response is
>> >> empty when it should include new HTML for the <div>s to be
>> updated. It
>> >> seems like there is some kind of setup that happens when you go
>> directly
>> >> to Home.html and click the rating link, but not when I've gone to the
>> >> home page via a DirectLink. I cannot see what would be different,
>> since
>> >> my pageBeginRender() method is called, and everything else happens
>> just
>> >> like it should in the component and in the page.
>> >>
>> >> If anyone has run into this before or has an idea regarding what this
>> >> might cause an async DirectLink to return nothing in some cases,
>> please
>> >> let me know. The pagination is a major part of my app, and users
>> need
>> >> to be able to submit ratings no matter which page they are on, so
>> I am
>> >> kind of dead in the water until I get this fixed. Next step is to
>> spend
>> >> quality time with the source code, but if anyone has a better idea
>> >> before I take that time...
>> >>
>> >> Cheers,
>> >> Matt
>> >>
>> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tap 4.1.1 problem: async direct link returns empty ajax response
Posted by Jesse Kuhnert <jk...@gmail.com>.
You want to do something like this instead for your divs:
<div jwcid="foo@Any" >
Then your updateComponents statement becomes
updateComponents="ognl:{page.components.foo.clientId,page.components.someOtherDiv.clientId}"
On 4/10/07, Matt Larson <sw...@ldnet.org> wrote:
> Jesse,
>
> Thanks for your response. This feels like the problem, that the IDs on
> the <div> tags are not being matched. However due to my lack of
> knowledge about Tapestry's internals, I haven't been able to implement
> your suggestion.
>
> What I can't figure out is how to get the clientId out of the OGNL
> expression you used (page.components.div1.clientId). I had a look at
> what is in the Map that page.components returns, and I don't see
> anything that looks like my components' clientIds in either the
> component.getClientId() or in the set of keys of the components Map.
> How do I get the clientId from a component named "div1", given that I'm
> in a For loop as well? I'm confused about what the updateComponents
> parameter in the DirectLink component should take instead of the IDs on
> the <div>s since I can't seem to retrieve the clientIds.
>
> Here is what I am doing now, using components with IDs to try to follow
> your example:
>
> In the .jwc file I have two components for <div>s that look like this:
>
> <component id="div1" type="Any">
> <binding name="id" value="ognl:'ratingStars' + hunch.id"/>
> </component>
>
> <component id="div2" type="Any">
> <binding name="id" value="ognl:'ratingImage' + hunch.id"/>
> </component>
>
> These are used to display the <div>s in the .html file, which will be
> updated by the asynchronous DirectLink.
>
> Then in my DirectLink component:
>
> <a jwcid="@DirectLink"
> listener="listener:submitRatingAjax"
> async="ognl:true"
> updateComponents="ognl:{'ratingImage' +
> hunch.id,'ratingStars' + hunch.id}">...</a>
>
> If you or anyone else can help direct me to the right way to get the
> clientIds for components for use within the updateComponents parameter,
> that would be greatly appreciated. I have looked at the source code and
> APIs but so far that hasn't cleared it up.
>
> Cheers,
> Matt
>
> Jesse Kuhnert wrote:
> > Hmm... You can try adding some of the server side logging stuff
> > outlined here: http://tapestry.apache.org/tapestry4.1/ajax/debugging.html
> > .
> >
> > I'm guessing that the clientId of the div's you are trying to update
> > doesn't match on these responses.
> >
> > One thing you could do as a test is if you currently do something like:
> >
> > <a jwcid="@DirectLink" updateComponents="div1,div2"
> >
> > change it to :
> >
> > <a jwcid="@DirectLink"
> > updateComponents="ognl:{page.components.div1.clientId,
> > page.components.div2.clientId}"
> >
> > I noticed something similar to this recently and probably need to make
> > updateComponents="a,b" automatically use the clientId and not
> > componentId to match id's on the response.
> >
> > Hopefully that's the problem.
> >
> > On 4/8/07, Matt Larson <sw...@ldnet.org> wrote:
> >> I have just run into a problem that I think is probably a bug, but may
> >> be something that I am doing wrong. It's definitely a showstopper in my
> >> app, though.
> >>
> >> I have a component that allows users to rate something via the normal
> >> kind of "stars" rating. After a user clicks a star the overall rating
> >> of the object is calculated and displayed as a graphic. I use a
> >> component that employs an asynchronous DirectLink to do this, with each
> >> star having a different value on submit, and it works quite nicely. I
> >> have this custom component on two different pages and I can submit
> >> ratings on both.
> >>
> >> However, I just added pagination, and as soon as you move off of the
> >> home page via the "next" pagination link, the DirectLink for ratings no
> >> longer returns anything. The pagination works using the standard kind of
> >> "start from" parameter, which calls a listener that simply does
> >> setStartFrom(int startFrom) and then lets the pageBeginRender() method
> >> calculate the objects to display.
> >>
> >> I do know the reason that the ratings no longer show the updated
> >> graphic--the AjaxResponse just returns empty tags, with no errors
> >> reported at all (had a look at this with firebug):
> >>
> >> <ajax-response></ajax-response>
> >>
> >> The actual link is firing just fine, and all of the server side
> >> processing happens as my logs show. It's just that the ajax response is
> >> empty when it should include new HTML for the <div>s to be updated. It
> >> seems like there is some kind of setup that happens when you go directly
> >> to Home.html and click the rating link, but not when I've gone to the
> >> home page via a DirectLink. I cannot see what would be different, since
> >> my pageBeginRender() method is called, and everything else happens just
> >> like it should in the component and in the page.
> >>
> >> If anyone has run into this before or has an idea regarding what this
> >> might cause an async DirectLink to return nothing in some cases, please
> >> let me know. The pagination is a major part of my app, and users need
> >> to be able to submit ratings no matter which page they are on, so I am
> >> kind of dead in the water until I get this fixed. Next step is to spend
> >> quality time with the source code, but if anyone has a better idea
> >> before I take that time...
> >>
> >> Cheers,
> >> Matt
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tap 4.1.1 problem: async direct link returns empty ajax response
Posted by Matt Larson <sw...@ldnet.org>.
Jesse,
Thanks for your response. This feels like the problem, that the IDs on
the <div> tags are not being matched. However due to my lack of
knowledge about Tapestry's internals, I haven't been able to implement
your suggestion.
What I can't figure out is how to get the clientId out of the OGNL
expression you used (page.components.div1.clientId). I had a look at
what is in the Map that page.components returns, and I don't see
anything that looks like my components' clientIds in either the
component.getClientId() or in the set of keys of the components Map.
How do I get the clientId from a component named "div1", given that I'm
in a For loop as well? I'm confused about what the updateComponents
parameter in the DirectLink component should take instead of the IDs on
the <div>s since I can't seem to retrieve the clientIds.
Here is what I am doing now, using components with IDs to try to follow
your example:
In the .jwc file I have two components for <div>s that look like this:
<component id="div1" type="Any">
<binding name="id" value="ognl:'ratingStars' + hunch.id"/>
</component>
<component id="div2" type="Any">
<binding name="id" value="ognl:'ratingImage' + hunch.id"/>
</component>
These are used to display the <div>s in the .html file, which will be
updated by the asynchronous DirectLink.
Then in my DirectLink component:
<a jwcid="@DirectLink"
listener="listener:submitRatingAjax"
async="ognl:true"
updateComponents="ognl:{'ratingImage' +
hunch.id,'ratingStars' + hunch.id}">...</a>
If you or anyone else can help direct me to the right way to get the
clientIds for components for use within the updateComponents parameter,
that would be greatly appreciated. I have looked at the source code and
APIs but so far that hasn't cleared it up.
Cheers,
Matt
Jesse Kuhnert wrote:
> Hmm... You can try adding some of the server side logging stuff
> outlined here: http://tapestry.apache.org/tapestry4.1/ajax/debugging.html
> .
>
> I'm guessing that the clientId of the div's you are trying to update
> doesn't match on these responses.
>
> One thing you could do as a test is if you currently do something like:
>
> <a jwcid="@DirectLink" updateComponents="div1,div2"
>
> change it to :
>
> <a jwcid="@DirectLink"
> updateComponents="ognl:{page.components.div1.clientId,
> page.components.div2.clientId}"
>
> I noticed something similar to this recently and probably need to make
> updateComponents="a,b" automatically use the clientId and not
> componentId to match id's on the response.
>
> Hopefully that's the problem.
>
> On 4/8/07, Matt Larson <sw...@ldnet.org> wrote:
>> I have just run into a problem that I think is probably a bug, but may
>> be something that I am doing wrong. It's definitely a showstopper in my
>> app, though.
>>
>> I have a component that allows users to rate something via the normal
>> kind of "stars" rating. After a user clicks a star the overall rating
>> of the object is calculated and displayed as a graphic. I use a
>> component that employs an asynchronous DirectLink to do this, with each
>> star having a different value on submit, and it works quite nicely. I
>> have this custom component on two different pages and I can submit
>> ratings on both.
>>
>> However, I just added pagination, and as soon as you move off of the
>> home page via the "next" pagination link, the DirectLink for ratings no
>> longer returns anything. The pagination works using the standard kind of
>> "start from" parameter, which calls a listener that simply does
>> setStartFrom(int startFrom) and then lets the pageBeginRender() method
>> calculate the objects to display.
>>
>> I do know the reason that the ratings no longer show the updated
>> graphic--the AjaxResponse just returns empty tags, with no errors
>> reported at all (had a look at this with firebug):
>>
>> <ajax-response></ajax-response>
>>
>> The actual link is firing just fine, and all of the server side
>> processing happens as my logs show. It's just that the ajax response is
>> empty when it should include new HTML for the <div>s to be updated. It
>> seems like there is some kind of setup that happens when you go directly
>> to Home.html and click the rating link, but not when I've gone to the
>> home page via a DirectLink. I cannot see what would be different, since
>> my pageBeginRender() method is called, and everything else happens just
>> like it should in the component and in the page.
>>
>> If anyone has run into this before or has an idea regarding what this
>> might cause an async DirectLink to return nothing in some cases, please
>> let me know. The pagination is a major part of my app, and users need
>> to be able to submit ratings no matter which page they are on, so I am
>> kind of dead in the water until I get this fixed. Next step is to spend
>> quality time with the source code, but if anyone has a better idea
>> before I take that time...
>>
>> Cheers,
>> Matt
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: Tap 4.1.1 problem: async direct link returns empty ajax response
Posted by Jesse Kuhnert <jk...@gmail.com>.
Hmm... You can try adding some of the server side logging stuff
outlined here: http://tapestry.apache.org/tapestry4.1/ajax/debugging.html
.
I'm guessing that the clientId of the div's you are trying to update
doesn't match on these responses.
One thing you could do as a test is if you currently do something like:
<a jwcid="@DirectLink" updateComponents="div1,div2"
change it to :
<a jwcid="@DirectLink"
updateComponents="ognl:{page.components.div1.clientId,
page.components.div2.clientId}"
I noticed something similar to this recently and probably need to make
updateComponents="a,b" automatically use the clientId and not
componentId to match id's on the response.
Hopefully that's the problem.
On 4/8/07, Matt Larson <sw...@ldnet.org> wrote:
> I have just run into a problem that I think is probably a bug, but may
> be something that I am doing wrong. It's definitely a showstopper in my
> app, though.
>
> I have a component that allows users to rate something via the normal
> kind of "stars" rating. After a user clicks a star the overall rating
> of the object is calculated and displayed as a graphic. I use a
> component that employs an asynchronous DirectLink to do this, with each
> star having a different value on submit, and it works quite nicely. I
> have this custom component on two different pages and I can submit
> ratings on both.
>
> However, I just added pagination, and as soon as you move off of the
> home page via the "next" pagination link, the DirectLink for ratings no
> longer returns anything. The pagination works using the standard kind of
> "start from" parameter, which calls a listener that simply does
> setStartFrom(int startFrom) and then lets the pageBeginRender() method
> calculate the objects to display.
>
> I do know the reason that the ratings no longer show the updated
> graphic--the AjaxResponse just returns empty tags, with no errors
> reported at all (had a look at this with firebug):
>
> <ajax-response></ajax-response>
>
> The actual link is firing just fine, and all of the server side
> processing happens as my logs show. It's just that the ajax response is
> empty when it should include new HTML for the <div>s to be updated. It
> seems like there is some kind of setup that happens when you go directly
> to Home.html and click the rating link, but not when I've gone to the
> home page via a DirectLink. I cannot see what would be different, since
> my pageBeginRender() method is called, and everything else happens just
> like it should in the component and in the page.
>
> If anyone has run into this before or has an idea regarding what this
> might cause an async DirectLink to return nothing in some cases, please
> let me know. The pagination is a major part of my app, and users need
> to be able to submit ratings no matter which page they are on, so I am
> kind of dead in the water until I get this fixed. Next step is to spend
> quality time with the source code, but if anyone has a better idea
> before I take that time...
>
> Cheers,
> Matt
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tapestry/Dojo team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org