hmm, how about using the tapx TemplateAPI and TemplateRenderer within a
tapestry app?

I don't need to do anything fancy like Page rendering, and infact am
just using a Page instance as  useful hook for ajax methods. 
>From this method I just want to return some html rendered with tml,
using tap's templating & expression language.

I've used tapx TemplateRenderer before with success, for sending HTML
emails. Was hoping to do something similar now, although having tried it
I get the following error:


        TemplateAPI templateAPI = new TemplateAPI("mypackage.web", new
File("/web/components"));
        TemplateRenderer renderer = templateAPI.createRenderer("Tiles", "en",
"default");
        RenderedStream renderedStream = renderer.render();

throws:

Caused by: java.lang.IllegalArgumentException: Location 'default' is not
defined. Defined location names: (none).

Any clues as to how to fix that error?


On Thu, 2011-06-30 at 14:07 -0700, Howard Lewis Ship wrote:

> You can ask any component to generate an event request Link using its
> component resources.  In Tapestry, you don't try to second guess, on
> the client side, what links will look like ... you ask the server side
> to generate a link, and then your JavaScript code can send Ajax
> requests to that component.
> 
> In terms of what you are trying to do ... Tapestry assumes most
> requests from the client will generate a partial page render response
> ... a particular format JSON response that contains HTML plus details
> about JavaScript libraries and initializations.  In any case, that's
> what a Zone (or anything Zone-like) needs.  If you can, use Zone.
> 
> Alternately, a component may send a response directly back to the
> client, which it be text, HTML, JSON, or something binary.
> 
> On Thu, Jun 30, 2011 at 1:55 PM, Joel Halbert <j...@su3analytics.com> wrote:
> > Can I access a component out of the context of a page?
> > i.e. does a component have to be bound to a Page to be rendered?
> >
> > I'm trying render a simple html template and fetch it from my JS.
> >
> >
> > On Thu, 2011-06-30 at 17:38 -0300, Thiago H. de Paula Figueiredo wrote:
> >> On Thu, 30 Jun 2011 17:26:35 -0300, Joel Halbert <j...@su3analytics.com>
> >> wrote:
> >>
> >> > Hi,
> >>
> >> Hi!
> >>
> >> > Is it possible to invoke a component directly via HTTP?
> >> >
> >> > E.g given a Tapestry Page:
> >> >
> >> > public class MyPage {
> >> >   Object onMyRequest() {
> >> >     return something;
> >> >   }
> >> > }
> >> >
> >> > I can call http://myapp/mypage:myrequest/ to return something.
> >> > Can I do the same for a component?
> >>
> >> It's not recommended to access components directly, but you can @Inject
> >> ComponentResources and use its createEventLink() method.
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
> 
> 
> 


Reply via email to