You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by binu pankajakshan <p_...@yahoo.com> on 2005/12/23 13:59:46 UTC

where to write the listener for a dynamically created link

Hi all.
  
  Am trying to display some links which are generated in the  renderComponent(IMarkupWriter , IRequestCycle) method of a component. I  want to know if I want a listener to be associated with it in where  should i write the code for it
  
  say for eg. the below is a sample component defined
  public class ListLink extends AbstractComponent 
  {
      public void renderComponent( IMarkupWriter writer, IRequestCycle cycle )
      {
          writer.printRaw("hi");
          writer.printRaw("<a href='#'  jwcid='@DirectLink'      listener='ognl:listeners.linkClicked'>click here ....</a>");
      }
  }
  
  The component is being displayed as part of another page .
  Can any  one help me out where do i write the linkClicked () method.
  
  In general if we write such block to dynamically generate the component body where do we write the listener methods.
  
  I Am new to tapestry so please tell me if i am doing it the right way and if not how can i do it.
  
  Thanks & Regards
  Binu
  

		
---------------------------------
Yahoo! for Good - Make a difference this year. 

Re: where to write the listener for a dynamically created link

Posted by binu pankajakshan <p_...@yahoo.com>.
Hi,
  Thanks for the help.
the code is working with a bit of change
  I am using tapestry 3.0.and am actually trying out something which i  have described below.but using this out there doesnt seems to help me  much.
  
  I want to read a .properties file. There are some key-value pairs in it  I want to display the key as a link. I want that when the link is  clicked the value read with it should be passed on to the a listener so  that it can pass it on to the next page where it can be used for  processing.
  The no. of key-value pairs keeps on changing.
  
  Is it possible in tapestry. if so then how to go abt it.
  
  Thanks & Regards
  Binu
  
Andreas Andreou <an...@di.uoa.gr> wrote:  Assuming tapestry 4,

WeirdComponent.html:

hi 

Click here...

and WeirdComponent.jwc:

    
    




No need for a .java file here

Andreas Andreou wrote:

>In the renderComponent method you only output html - not tapesty
>template code.
>Even if you try it (be running the code you showed us), you'll see that
>the template
>you're outputting is NOT processed by tapestry.
>
>You can try defining a listener parameter for your component and
>creating an html template that uses it.
>
>binu pankajakshan wrote:
>
>  
>
>>Hi all.
>> 
>>  Am trying to display some links which are generated in the  renderComponent(IMarkupWriter , IRequestCycle) method of a component. I  want to know if I want a listener to be associated with it in where  should i write the code for it
>> 
>> say for eg. the below is a sample component defined
>> public class ListLink extends AbstractComponent 
>> {
>>     public void renderComponent( IMarkupWriter writer, IRequestCycle cycle )
>>     {
>>         writer.printRaw("hi");
>>         writer.printRaw("click here ....");
>>     }
>> }
>> 
>> The component is being displayed as part of another page .
>> Can any  one help me out where do i write the linkClicked () method.
>> 
>> In general if we write such block to dynamically generate the component body where do we write the listener methods.
>> 
>> I Am new to tapestry so please tell me if i am doing it the right way and if not how can i do it.
>> 
>> Thanks & Regards
>> Binu
>> 
>>
>>  
>>---------------------------------
>>Yahoo! for Good - Make a difference this year. 
>> 
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

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




		
---------------------------------
Yahoo! Photos
 Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

Re: where to write the listener for a dynamically created link

Posted by Andreas Andreou <an...@di.uoa.gr>.
Assuming tapestry 4,

WeirdComponent.html:

hi <br>
<a jwcid="@DirectLink" href="#" listener="ognl:myListener">Click here...</a>

and WeirdComponent.jwc:

<component-specification>    
    <parameter name="myListener" required="yes"/>
</component-specification>

No need for a .java file here

Andreas Andreou wrote:

>In the renderComponent method you only output html - not tapesty
>template code.
>Even if you try it (be running the code you showed us), you'll see that
>the template
>you're outputting is NOT processed by tapestry.
>
>You can try defining a listener parameter for your component and
>creating an html template that uses it.
>
>binu pankajakshan wrote:
>
>  
>
>>Hi all.
>> 
>> Am trying to display some links which are generated in the  renderComponent(IMarkupWriter , IRequestCycle) method of a component. I  want to know if I want a listener to be associated with it in where  should i write the code for it
>> 
>> say for eg. the below is a sample component defined
>> public class ListLink extends AbstractComponent 
>> {
>>     public void renderComponent( IMarkupWriter writer, IRequestCycle cycle )
>>     {
>>         writer.printRaw("hi");
>>         writer.printRaw("<a href='#'  jwcid='@DirectLink'      listener='ognl:listeners.linkClicked'>click here ....</a>");
>>     }
>> }
>> 
>> The component is being displayed as part of another page .
>> Can any  one help me out where do i write the linkClicked () method.
>> 
>> In general if we write such block to dynamically generate the component body where do we write the listener methods.
>> 
>> I Am new to tapestry so please tell me if i am doing it the right way and if not how can i do it.
>> 
>> Thanks & Regards
>> Binu
>> 
>>
>>		
>>---------------------------------
>>Yahoo! for Good - Make a difference this year. 
>> 
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

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


Re: where to write the listener for a dynamically created link

Posted by binu <p_...@yahoo.com>.
Thanks Andreas,
I tried had tried out wht u suggested but it didnt work.
can you just put in ur idea in a sample code so i can be sure i did it in the 
same way that u are saying.




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


Re: where to write the listener for a dynamically created link

Posted by binu pankajakshan <p_...@yahoo.com>.
Thanks Adreas,
  I tried out what u have suggested but it didnt work out.
  can you put down what u suggested in code so that i can be sure i did it the right way.

Andreas Andreou <an...@di.uoa.gr> wrote:  In the renderComponent method you only output html - not tapesty
template code.
Even if you try it (be running the code you showed us), you'll see that
the template
you're outputting is NOT processed by tapestry.

You can try defining a listener parameter for your component and
creating an html template that uses it.

binu pankajakshan wrote:

>Hi all.
>  
>  Am trying to display some links which are generated in the  renderComponent(IMarkupWriter , IRequestCycle) method of a component. I  want to know if I want a listener to be associated with it in where  should i write the code for it
>  
>  say for eg. the below is a sample component defined
>  public class ListLink extends AbstractComponent 
>  {
>      public void renderComponent( IMarkupWriter writer, IRequestCycle cycle )
>      {
>          writer.printRaw("hi");
>          writer.printRaw("click here ....");
>      }
>  }
>  
>  The component is being displayed as part of another page .
>  Can any  one help me out where do i write the linkClicked () method.
>  
>  In general if we write such block to dynamically generate the component body where do we write the listener methods.
>  
>  I Am new to tapestry so please tell me if i am doing it the right way and if not how can i do it.
>  
>  Thanks & Regards
>  Binu
>  
>
>  
>---------------------------------
>Yahoo! for Good - Make a difference this year. 
>  
>

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





Accenture Services Pvt. Ltd.  
Tek Medows
  51,Old Mahabalipuram Road
  Sholinganallur,Chennai-600119  
Contact No: +91 98203 46870
  
    'My will shall shape the future. Whether I fail or succeed shall be no  man's doing but my own. I am the force; I can clear any obstacle before  me or I can be lost in the maze. My choice; my responsibility; win or  lose, only I hold the key to my destiny.'

		
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 

Re: where to write the listener for a dynamically created link

Posted by Andreas Andreou <an...@di.uoa.gr>.
In the renderComponent method you only output html - not tapesty
template code.
Even if you try it (be running the code you showed us), you'll see that
the template
you're outputting is NOT processed by tapestry.

You can try defining a listener parameter for your component and
creating an html template that uses it.

binu pankajakshan wrote:

>Hi all.
>  
>  Am trying to display some links which are generated in the  renderComponent(IMarkupWriter , IRequestCycle) method of a component. I  want to know if I want a listener to be associated with it in where  should i write the code for it
>  
>  say for eg. the below is a sample component defined
>  public class ListLink extends AbstractComponent 
>  {
>      public void renderComponent( IMarkupWriter writer, IRequestCycle cycle )
>      {
>          writer.printRaw("hi");
>          writer.printRaw("<a href='#'  jwcid='@DirectLink'      listener='ognl:listeners.linkClicked'>click here ....</a>");
>      }
>  }
>  
>  The component is being displayed as part of another page .
>  Can any  one help me out where do i write the linkClicked () method.
>  
>  In general if we write such block to dynamically generate the component body where do we write the listener methods.
>  
>  I Am new to tapestry so please tell me if i am doing it the right way and if not how can i do it.
>  
>  Thanks & Regards
>  Binu
>  
>
>		
>---------------------------------
>Yahoo! for Good - Make a difference this year. 
>  
>

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