You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ea...@gmx.de on 2004/03/06 11:28:51 UTC

Please reply: component without html template /Petshop

I tried using AbstractComponent, but it also wants to have an html template.

So, I go down another step and try IComponent.

public abstract class MyComponent implements IComponent {
	public void renderBody(IMarkupWriter writer, IRequestCycle cycle) {
         writer.printRaw("hallolalalal");
	}

}

But this produces a java.lang.AbstractMethod error within PageLoader in line
679.



Any ideas? Is it really that difficult to create an own component that will
render itself with information from a database and also receive its layout
from a database?
Thats the only reason why I want to do my own component that I could call
within an html "page" like that

<span jwcid="@MyComponent"/> 

I dont want to pass any parameters to it, there is no binding and nothing
along these lines.
I just would like to have a stupid little component I can insert at any page
that will insert a component, .eg. WeatherBlock, an options menu etc..

What I think is an anti-example of a good tapestry application is the
petshop example.
the Options window should not be hardcoded on every page where it might be
useful.
It should be inserted using a component for.

Thanks!




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


Re: Please reply: component without html template /Petshop

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 6, 2004, at 5:28 AM, easy-to-remember@gmx.de wrote:
> I tried using AbstractComponent, but it also wants to have an html 
> template.

That is the point of AbstractComponent.  Use BaseComponent if you want 
to specify a template.

> Any ideas? Is it really that difficult to create an own component that 
> will
> render itself with information from a database and also receive its 
> layout
> from a database?
> Thats the only reason why I want to do my own component that I could 
> call
> within an html "page" like that
>
> <span jwcid="@MyComponent"/>
>
> I dont want to pass any parameters to it, there is no binding and 
> nothing
> along these lines.
> I just would like to have a stupid little component I can insert at 
> any page
> that will insert a component, .eg. WeatherBlock, an options menu etc..

I'm not following entirely what you are trying to do.  But here is my 
suggestion based on what I *think* you are trying to do.  You want a 
dynamically generated template with access to components.  Use 
BaseComponent.  But do not have a template.  Then register an 
ITemplateSourceDelegate extension, which provides the template when 
Tapestry cannot find it.  That template can use components like you 
specified.  If you need bindings, have a static .jwc or .page whichever 
is appropriate.

I don't have time at the moment to detail how to do this more, but the 
archives should have some ITemplateSourceDelegate info.

> What I think is an anti-example of a good tapestry application is the
> petshop example.
> the Options window should not be hardcoded on every page where it 
> might be
> useful.
> It should be inserted using a component for.

But putting the same thing on every page is really the job for a custom 
Border, like Workbench uses.  So maybe you're better off doing it this 
way?

	Erik


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