You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2006/09/09 04:50:14 UTC

@EventListener question

Hello there! Does EventListener + ResponseBuilder supports all
components? For instance, is it possible to update contents presented
by a @Insert?
I was trying a simple quote app and can't get it working:

@EventListener(elements = "fetchQuotes", events="onmouseover")
	public void getQuotes(IRequestCycle cycle){
		ResponseBuilder builder = cycle.getResponseBuilder();
		setQuote(getQuotesFromDB());
		builder.updateComponent("quoteDiv");
		
	}

<div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
over here to get more quotes...</div><br><br>
		
<div id="quoteDiv"><span jwcid="quotePhrase@Insert"
value="ognl:quote"></span></div>

What's the right way?


Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: @EventListener question

Posted by Julian Wood <wo...@ucalgary.ca>.
I think what Jesse says is exactly what is expected and intuitive,  
but I've just spent 3 hours proving that it needs those "redundant"  
divs if you want it to work (unless I've misunderstood, or am  
approaching this wrong).

Case in point, using the Dec 12, 4.1.1 snapshot:

@EventListener( events = "onchange", targets="hotspotSelection",  
async=true, submitForm = "hotspotSelectForm", validateForm = false)
     public void viewHotspot(IRequestCycle cycle) {
         cycle.getResponseBuilder().updateComponent("hotspotId");
     }

--

<input jwcid="hotspotId@TextField" value="ognl: selectedHotspot.id" />

--

doesn't work. The proper ajax response is returned with the correct  
data, but the hotspotId is never updated in js (not sure why).

Wrapping it in a div fixes the problem:

@EventListener( events = "onchange", targets="hotspotSelection",  
async=true, submitForm = "hotspotSelectForm", validateForm = false)
     public void viewHotspot(IRequestCycle cycle) {
         cycle.getResponseBuilder().updateComponent("hotspotIdDiv");
     }

--

<div jwcid="hotspotIdDiv@Any"><input jwcid="hotspotId@TextField"  
value="ognl: selectedHotspot.id" /></div>

--

Hopefully that helps someone else. BTW, I love the new AJAX  
functionality and appreciate everyone's work!!

J



On 10-Sep-06, at 8:43 AM, Jesse Kuhnert wrote:

> Also, just as an FYI a lot of the examples I've been seeing lately  
> include
> what appears to be a lot of redundant <div> enclosures around  
> content you
> want to update.
>
> I've worked very hard to make sure the component id logic is  
> universally
> correct, so you should be able to just reference a particular  
> component
> directly for updating..
>
> The only time you need to enclose something is when it may not  
> actually be
> rendered yet (and therefore not have any html element to replace on an
> update)..One example of this is a <span jwcid="@If" > type block.
>
> On 9/9/06, Josh Long <st...@gmail.com> wrote:
>>
>> I'm not 100% sure, but try changing div id ="quoteDiv" to <div
>> jwcid="quoteDiv@Any"> ...
>>
>> That way, builder.updateComponent wil update a tapestry component..
>>
>> Peace,
>> Josh
>>
>> On 9/8/06, Vinicius Carvalho <ja...@gmail.com> wrote:
>> > Hello there! Does EventListener + ResponseBuilder supports all
>> > components? For instance, is it possible to update contents  
>> presented
>> > by a @Insert?
>> > I was trying a simple quote app and can't get it working:
>> >
>> > @EventListener(elements = "fetchQuotes", events="onmouseover")
>> >         public void getQuotes(IRequestCycle cycle){
>> >                 ResponseBuilder builder =  
>> cycle.getResponseBuilder();
>> >                 setQuote(getQuotesFromDB());
>> >                 builder.updateComponent("quoteDiv");
>> >
>> >         }
>> >
>> > <div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
>> > over here to get more quotes...</div><br><br>
>> >
>> > <div id="quoteDiv"><span jwcid="quotePhrase@Insert"
>> > value="ognl:quote"></span></div>
>> >
>> > What's the right way?
>> >
>> >
>> > Regards
>> >
>> > -
--
Julian Wood <wo...@ucalgary.ca>

Software Engineer
Teaching & Learning Centre
University of Calgary

http://tlc.ucalgary.ca



Re: @EventListener question

Posted by Vinicius Carvalho <ja...@gmail.com>.
Thanks, that was it :D

On 9/11/06, Chaitanya Jeerage <cj...@gmail.com> wrote:
> I have faced problems before while updating components other than div,
> may be I was doing something wrong, anyway afaik this should work
>
> <div jwcid="quoteDiv@Any">
>    <span  jwcid="quotePhrase@Insert" value="ognl:quote"></span>
> </div>
>
> I think this is what Josh was indicating too.
>
> -Chaitanya
>
>
> On 9/11/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> > Josh, I really can't see how would that work... since I'm using @Any,
> > where would the text be rendered? I gave it a try and it is not
> > working...
> >
> > Any other ideas?
> >
> > Regards
> >
> > On 9/10/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > > Also, just as an FYI a lot of the examples I've been seeing lately include
> > > what appears to be a lot of redundant <div> enclosures around content you
> > > want to update.
> > >
> > > I've worked very hard to make sure the component id logic is universally
> > > correct, so you should be able to just reference a particular component
> > > directly for updating..
> > >
> > > The only time you need to enclose something is when it may not actually be
> > > rendered yet (and therefore not have any html element to replace on an
> > > update)..One example of this is a <span jwcid="@If" > type block.
> > >
> > > On 9/9/06, Josh Long <st...@gmail.com> wrote:
> > > >
> > > > I'm not 100% sure, but try changing div id ="quoteDiv" to <div
> > > > jwcid="quoteDiv@Any"> ...
> > > >
> > > > That way, builder.updateComponent wil update a tapestry component..
> > > >
> > > > Peace,
> > > > Josh
> > > >
> > > > On 9/8/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> > > > > Hello there! Does EventListener + ResponseBuilder supports all
> > > > > components? For instance, is it possible to update contents presented
> > > > > by a @Insert?
> > > > > I was trying a simple quote app and can't get it working:
> > > > >
> > > > > @EventListener(elements = "fetchQuotes", events="onmouseover")
> > > > >         public void getQuotes(IRequestCycle cycle){
> > > > >                 ResponseBuilder builder = cycle.getResponseBuilder();
> > > > >                 setQuote(getQuotesFromDB());
> > > > >                 builder.updateComponent("quoteDiv");
> > > > >
> > > > >         }
> > > > >
> > > > > <div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
> > > > > over here to get more quotes...</div><br><br>
> > > > >
> > > > > <div id="quoteDiv"><span jwcid="quotePhrase@Insert"
> > > > > value="ognl:quote"></span></div>
> > > > >
> > > > > What's the right way?
> > > > >
> > > > >
> > > > > Regards
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > 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/(and a dash of TestNG), 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
> >
> >
>
> ---------------------------------------------------------------------
> 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: @EventListener question

Posted by Chaitanya Jeerage <cj...@gmail.com>.
I have faced problems before while updating components other than div,
may be I was doing something wrong, anyway afaik this should work

<div jwcid="quoteDiv@Any">
   <span  jwcid="quotePhrase@Insert" value="ognl:quote"></span>
</div>

I think this is what Josh was indicating too.

-Chaitanya


On 9/11/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> Josh, I really can't see how would that work... since I'm using @Any,
> where would the text be rendered? I gave it a try and it is not
> working...
>
> Any other ideas?
>
> Regards
>
> On 9/10/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> > Also, just as an FYI a lot of the examples I've been seeing lately include
> > what appears to be a lot of redundant <div> enclosures around content you
> > want to update.
> >
> > I've worked very hard to make sure the component id logic is universally
> > correct, so you should be able to just reference a particular component
> > directly for updating..
> >
> > The only time you need to enclose something is when it may not actually be
> > rendered yet (and therefore not have any html element to replace on an
> > update)..One example of this is a <span jwcid="@If" > type block.
> >
> > On 9/9/06, Josh Long <st...@gmail.com> wrote:
> > >
> > > I'm not 100% sure, but try changing div id ="quoteDiv" to <div
> > > jwcid="quoteDiv@Any"> ...
> > >
> > > That way, builder.updateComponent wil update a tapestry component..
> > >
> > > Peace,
> > > Josh
> > >
> > > On 9/8/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> > > > Hello there! Does EventListener + ResponseBuilder supports all
> > > > components? For instance, is it possible to update contents presented
> > > > by a @Insert?
> > > > I was trying a simple quote app and can't get it working:
> > > >
> > > > @EventListener(elements = "fetchQuotes", events="onmouseover")
> > > >         public void getQuotes(IRequestCycle cycle){
> > > >                 ResponseBuilder builder = cycle.getResponseBuilder();
> > > >                 setQuote(getQuotesFromDB());
> > > >                 builder.updateComponent("quoteDiv");
> > > >
> > > >         }
> > > >
> > > > <div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
> > > > over here to get more quotes...</div><br><br>
> > > >
> > > > <div id="quoteDiv"><span jwcid="quotePhrase@Insert"
> > > > value="ognl:quote"></span></div>
> > > >
> > > > What's the right way?
> > > >
> > > >
> > > > Regards
> > > >
> > > > ---------------------------------------------------------------------
> > > > 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/(and a dash of TestNG), 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
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: @EventListener question

Posted by Vinicius Carvalho <ja...@gmail.com>.
Josh, I really can't see how would that work... since I'm using @Any,
where would the text be rendered? I gave it a try and it is not
working...

Any other ideas?

Regards

On 9/10/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> Also, just as an FYI a lot of the examples I've been seeing lately include
> what appears to be a lot of redundant <div> enclosures around content you
> want to update.
>
> I've worked very hard to make sure the component id logic is universally
> correct, so you should be able to just reference a particular component
> directly for updating..
>
> The only time you need to enclose something is when it may not actually be
> rendered yet (and therefore not have any html element to replace on an
> update)..One example of this is a <span jwcid="@If" > type block.
>
> On 9/9/06, Josh Long <st...@gmail.com> wrote:
> >
> > I'm not 100% sure, but try changing div id ="quoteDiv" to <div
> > jwcid="quoteDiv@Any"> ...
> >
> > That way, builder.updateComponent wil update a tapestry component..
> >
> > Peace,
> > Josh
> >
> > On 9/8/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> > > Hello there! Does EventListener + ResponseBuilder supports all
> > > components? For instance, is it possible to update contents presented
> > > by a @Insert?
> > > I was trying a simple quote app and can't get it working:
> > >
> > > @EventListener(elements = "fetchQuotes", events="onmouseover")
> > >         public void getQuotes(IRequestCycle cycle){
> > >                 ResponseBuilder builder = cycle.getResponseBuilder();
> > >                 setQuote(getQuotesFromDB());
> > >                 builder.updateComponent("quoteDiv");
> > >
> > >         }
> > >
> > > <div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
> > > over here to get more quotes...</div><br><br>
> > >
> > > <div id="quoteDiv"><span jwcid="quotePhrase@Insert"
> > > value="ognl:quote"></span></div>
> > >
> > > What's the right way?
> > >
> > >
> > > Regards
> > >
> > > ---------------------------------------------------------------------
> > > 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/(and a dash of TestNG), 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: @EventListener question

Posted by Jesse Kuhnert <jk...@gmail.com>.
Also, just as an FYI a lot of the examples I've been seeing lately include
what appears to be a lot of redundant <div> enclosures around content you
want to update.

I've worked very hard to make sure the component id logic is universally
correct, so you should be able to just reference a particular component
directly for updating..

The only time you need to enclose something is when it may not actually be
rendered yet (and therefore not have any html element to replace on an
update)..One example of this is a <span jwcid="@If" > type block.

On 9/9/06, Josh Long <st...@gmail.com> wrote:
>
> I'm not 100% sure, but try changing div id ="quoteDiv" to <div
> jwcid="quoteDiv@Any"> ...
>
> That way, builder.updateComponent wil update a tapestry component..
>
> Peace,
> Josh
>
> On 9/8/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> > Hello there! Does EventListener + ResponseBuilder supports all
> > components? For instance, is it possible to update contents presented
> > by a @Insert?
> > I was trying a simple quote app and can't get it working:
> >
> > @EventListener(elements = "fetchQuotes", events="onmouseover")
> >         public void getQuotes(IRequestCycle cycle){
> >                 ResponseBuilder builder = cycle.getResponseBuilder();
> >                 setQuote(getQuotesFromDB());
> >                 builder.updateComponent("quoteDiv");
> >
> >         }
> >
> > <div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
> > over here to get more quotes...</div><br><br>
> >
> > <div id="quoteDiv"><span jwcid="quotePhrase@Insert"
> > value="ognl:quote"></span></div>
> >
> > What's the right way?
> >
> >
> > Regards
> >
> > ---------------------------------------------------------------------
> > 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/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Re: @EventListener question

Posted by Josh Long <st...@gmail.com>.
I'm not 100% sure, but try changing div id ="quoteDiv" to <div
jwcid="quoteDiv@Any"> ...

That way, builder.updateComponent wil update a tapestry component..

Peace,
Josh

On 9/8/06, Vinicius Carvalho <ja...@gmail.com> wrote:
> Hello there! Does EventListener + ResponseBuilder supports all
> components? For instance, is it possible to update contents presented
> by a @Insert?
> I was trying a simple quote app and can't get it working:
>
> @EventListener(elements = "fetchQuotes", events="onmouseover")
>         public void getQuotes(IRequestCycle cycle){
>                 ResponseBuilder builder = cycle.getResponseBuilder();
>                 setQuote(getQuotesFromDB());
>                 builder.updateComponent("quoteDiv");
>
>         }
>
> <div id="fetchQuotes"><span jwcid="@Insert" value="ognl:now"/>Mouse
> over here to get more quotes...</div><br><br>
>
> <div id="quoteDiv"><span jwcid="quotePhrase@Insert"
> value="ognl:quote"></span></div>
>
> What's the right way?
>
>
> Regards
>
> ---------------------------------------------------------------------
> 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