[jboss-user] [JBoss Portal] - Re: Injection of header content (title, scripts) with portal

andiXT do-not-reply at jboss.com
Tue Nov 18 06:53:57 EST 2008


1. Ok, I have included in my layouts 
 <title><p:title default="<%= PortalConstants.VERSION.toString() %>"/></title>
  | 
And it really helped me. But only when I replaced portal-layout.tld from portal 2.6 with version from portal 2.7. I think this point should be noticed in reference guide in migration chapter. Also it should be noticed that we should add this specific tag to our layouts.

2. Somehow my  <p:headerContent/> started to output injected header contents from portlets. I don't know how. But the problem is that your tag handler (HeaderContentTagHandler) doesn't know how to parse w3c.dom.Element, so they just do simple Element.toString(). But, doing this, it returns following:

  | [meta: null][meta: null][link: null] [script: null] 
for java code:

  | 		Element element = response.createElement("title");
  | 		element.setTextContent("Just small");
  | 		response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, element);
  | 		
  | 		Element elementK = response.createElement("meta");
  | 		elementK.setAttribute("name", "keywords");
  | 		elementK.setAttribute("content", "keyword,new keyword");
  | 		response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, elementK);
  | 		
  | 		Element elementD = response.createElement("meta");
  | 		elementD.setAttribute("name", "description");
  | 		elementD.setAttribute("content", "sample description");
  | 		response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, elementD);
  | 
  | 
  | 		Element elementL = response.createElement("link");
  | 		elementL.setAttribute("type", "text/css");
  | 		elementL.setAttribute("rel", "stylesheet");
  | 		elementL.setAttribute("href", "/local/yuruy.css");
  | 		response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, elementL);
  | 		
  | 		Element elementS = response.createElement("script");
  | 		elementS.setAttribute("type", "text/javascript");
  | 		elementS.setAttribute("src", "/local/yuruy.js");
  | 		response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, elementS);      		
  | 		
  | 		response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, "<meta name="simple"></meta>");
  | 
For last one "meta" no output at all.

So, as you can see, it returns some object instead of valid xml tag string. I ahve found the message, that it's a bug, or maybe other behavior of java 1.5, because in 1.4.2 it returned proper xml string. More here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6181019

So, what to do, what workaround use to have tags in page header? We are using xml-apis-1.3.03.jar for w3c.dom.Element

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190073#4190073

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4190073



More information about the jboss-user mailing list