• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inserting a new sub-component (programmatically) in appendToResponse()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting a new sub-component (programmatically) in appendToResponse()


  • Subject: Re: Inserting a new sub-component (programmatically) in appendToResponse()
  • From: Lachlan Deck <email@hidden>
  • Date: Tue, 9 Jun 2009 15:44:57 +1000

On 08/06/2009, at 10:58 PM, Mark Gowdy wrote:

I need to insert a new sub-component into a page during the request- response cycle (probably within appendToResponse() )

I thought I had achieved this, but all the links on the page are now broken (and other general weirdness unfolds)

This is the essence what I need to achieve (I removed all the specific crud that you don't need)

This breaks:
public void appendToResponse(WOResponse a_rsp, WOContext a_ctx) {
	super.appendToResponse(a_rsp, a_ctx);

// Prepare a sub-component (then pass it bindings, etc..)
// DisplayArticle generatedContent = ((ERXApplication )ERXApplication.application()).pageWithName(DisplayArticle.class, a_ctx); // the other way
DisplayArticle newComponent = (DisplayArticle)pageWithName("DisplayArticle");
String generatedContentForCMSTag = newComponent.generateResponse().contentString();
// Do stuff
// Update a_rsp.setContent(adjustedContent);
}

I usually clone the current request and process. Also try adding it to a String getter:
But something like the following should work.


public String articleContent() {
WORequest request = (WORequest) context().request().clone();
WOContext context = ERXApplication.erxApplication().createContextForRequest(request);
DisplayArticle articleView = ERXApplication.erxApplication().pageWithName(DisplayArticle.class, context);
String generatedContent = articleView.generatedResponse().contentString();
// do stuff
return generatedContent;
}


with regards,
--

Lachlan Deck

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Inserting a new sub-component (programmatically) in appendToResponse() (From: Mark Gowdy <email@hidden>)

  • Prev by Date: Re: [WWDC] Any supper plans for Monday?
  • Next by Date: WOWODC - a few pics
  • Previous by thread: Inserting a new sub-component (programmatically) in appendToResponse()
  • Next by thread: Re: Inserting a new sub-component (programmatically) in appendToResponse()
  • Index(es):
    • Date
    • Thread