OC,

I had to do it for my PDF generation tool...

You want the component outside the current context, I do not remember why. If 
you want complete URL instead of relative, do context.generateCompleteURLs() 
before generating the response.

ERXWOContext newContext = new ERXWOContext(context.request());
Component component = 
ERXApplication.erxApplication().pageWithName(Component.class, newContext);
WOResponse response = component.generateResponse();

String html = response.contentString();

Samuel


> Le 2015-02-13 à 12:54, OC <[email protected]> a écrit :
> 
> Hello there,
> 
> is it possible to pre-render a component to HTML string, and cache that 
> string?
> 
> I thought this code would work:
> 
> === code ===
> ...
> private String cache=null
> String componentContent {
>  if (!cache) {
>    def component=pageWithName(COMPONENT_NAME)
>    component.awake()
>    WOResponse nr=component.generateResponse()
>    cache=nr.contentString()
>  }
>  return cache
> }
> ...
> === HTML ===
> ...
> <wo:str value="$componentContent" escapeHTML="NO"/>
> ...
> ===
> 
> but it does not -- it messes up my current context, it seems.
> 
> Thanks for any advice,
> OC
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com
> 
> This email sent to [email protected]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to