On 6 Mar 2006, at 10:56, Vincent Coetzee wrote:

I have a WebObjects component that I have developed that is a partial document. It preferably needs to insert some content into the <head></head> portion of a page, and additionally only needs to insert it if it is no already there. How does one insert content into <head></head> and test whether it has already been inserted.

There's a fundamental programming principle at stake here: "you can't get there from here", which Jerry has already (indirectly) alluded to. When you can't see a simple way of doing something, your design probably needs revision.

To set a <head> value, you should be using a page wrapper component that picks up the appropriate value from somewhere in your application (the current component, using context().page(), or session, depending on your design).

Or if you want to do it the hard way, override appendToResponse and parse the contentString(), then set it back. That'll work for anything. One approach that I have never tried personally, but may also work for this, would be to use the contentAsDOMDocument() method to locate the <head> node and update it.

Paul

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

This email sent to [email protected]

Reply via email to