You can add custom head elements from your portlet code since Jetspeed-2.2.1 supports the feature, "PLT.12.5.4 Setting Markup Head Elements", defined in the Portlet Specification. Basically, you can use the following to create and contribute your head element: - javax.portlet.PortletResponse#createElement(tagName); - javax.portlet.PortletResponse#addProperty(javax.portlet.MimeResponse.MARKUP_HEAD_ELEMENT, elem); - It is recommended to override javax.portlet.GenericPortlet#doHeaders(req, res) to contribute your head elements.
For example, you can create a css or script tag element and contribute it to portal page. Jetspeed-2 portal will include your contributed elements properly. One extensional behavior is that Jetspeed-2 portal keeps the first contributed head element only if there's duplicate head element contributions from other portlets. If a contributed head element has an (case-insensitive) ID attribute (e.g., id='democss'), then Jetspeed-2 portal will regard the id attribute as an identifier. If there's another head element contribution from other portlet with same id attribute value, then that head element with the same id will be just ignored. If contributed head elements don't have ID attributes, then the stringified expression of the head element will be used to compare. If there's anything different in attributes, text or order, those will be treated as different head elements. By the way, the demo.css in demo PA doesn't seem to be related to this context. It seems like an old dojo example. HTH, Woonsan --- On Wed, 1/26/11, anyz <[email protected]> wrote: > From: anyz <[email protected]> > Subject: Re: How to link custom css/js in portlet fragment > To: "Jetspeed Users List" <[email protected]> > Date: Wednesday, January 26, 2011, 12:52 PM > Just to elaborate a bit, there is > demo.css in demo webapplication shipped > with J2 (2.2.1). I could not find where this css file is > imported in JSP > pages for portlets in this application. That is exactly > what i need to do. > > > > > On Wed, Jan 26, 2011 at 4:38 PM, anyz <[email protected]> > wrote: > > > Its could be more portlet specific question but i > think every portlet > > platform might be providing its own way. > > > > Since we don't have control over <head> tag in > portlet JSP page. How can i > > import a css/js file required for a portlet in > fragment JSP in Jetspeed. > > There could be multiple portlets that uses same or > differnt CSS and > > Javascript files, how can we make sure a resource (css > or js) is included > > exactly once. > > > > Thanks > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
