Well, your component will have a field with a parameter:

public class SomeComponent {
  @Parameter
  private int rowsPerPage;
}

If you modify the class to expose that value by adding:

  public int getRowsPerPage() { return rowsPerPage; }

  Or by adding @Property annotation to the rowsPerPage field.

Your now on the right track.

You can inject the component instance into the containing page (or component):

public class MyPage {

  @Property @InjectComponent
  private SomeComponent zulu;

}

And in your MyPage.tml, reference the component's property and inside
it, rowsPerPage:

  <t:somecomponent t:id="zulu" rowsPerPage="17"> ....  The component
has ${zulu.rowsPerPage} rows per page.

In other words, if your component wants to make that information
visible, it can do so.  There's a bunch of variations on this, of
course. As you get more experienced with OO development and Tapestry,
you'll see a lot of ways to take advantage of the fact that
information is organized into objects and properties.

On Wed, Aug 17, 2011 at 4:51 PM, locoder <g_u...@hotmail.de> wrote:
> The reason is that the component which is used on the page is from a Library
> which all new projects are based on. So I dont want to change the component
> to take "prop:rowsPerPage" instead of just rowsPerPage for deployment
> reasons also.
>
> So I want the ajax functionality to integrate seemles into my project which
> is based on a snapshot from a repository server which provides the component
> im using on the page :)
>
> So all i want is reading the attribute rowsPerPage from the component which
> is called in my index.tml. This component. It works with the mentioned
> method in my first post but i want to get the number not something like
> Renderable[rowsPerPage[4]].
>
> Like i said im new to tapestry and to be honest also new to Java (PHP
> developer).
>
> Regards,
> locoder
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/get-component-attribute-tp4708958p4710389.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
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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

Reply via email to