• 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 contents in <head>
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting contents in <head>


  • Subject: Re: Inserting contents in <head>
  • From: Paul Lynch <email@hidden>
  • Date: Mon, 6 Mar 2006 13:04:45 +0000


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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Inserting contents in <head> (From: Vincent Coetzee <email@hidden>)

  • Prev by Date: Re: Inserting contents in <head>
  • Next by Date: Re: Inserting contents in <head>
  • Previous by thread: Re: Inserting contents in <head>
  • Next by thread: Re: Inserting contents in <head>
  • Index(es):
    • Date
    • Thread