--- On Fri, 4/22/11, anyz <anyz...@gmail.com> wrote: > From: anyz <anyz...@gmail.com> > Subject: Re: JSP include and multiple portlets Problem > To: "Jetspeed Users List" <jetspeed-user@portals.apache.org> > Date: Friday, April 22, 2011, 8:11 AM > Thanks Woonsan, > > 1- First I am using > org.apache.portals.bridges.common.GenericServletPortlet > and hence no Java file exists for portlet but viewPage is > set to JSP > directly.
You might want to extend GenericServletPortlet to have another HeaderPage init parameter, so you can configure headers JSP page to be dispatched in doHeaders() method. You don't have to create java class for each portlet. Please refer to the example [1]. [1] http://svn.apache.org/repos/asf/portals/applications/gems/tags/apa-gems-1.1/src/main/java/org/apache/portals/gems/dojo/AbstractDojoVelocityPortlet.java > > 2- Even if i create the Java file for each portlet i.e. > makeing portlets of > Type GenericPortlet instead of GenericServletPortlet. This > will solve the > issue duplicate markup elements in header. However each of > my JSP file in > turn includes common files say "Header.jsp". This common > file has losts of > JSP scriptlet code as well as static css and Js . Thus > static Js and CSS can > be moved to doHeaders() but scriplet code in Header.jsp > will still > duplicated for all portlets. I'm not sure, but you could consider moving the common scriptlet codes into a portlet filter if you want to make it sure to be invoked at lease or only once. HTH, Woonsan > > > > > On Thu, Apr 21, 2011 at 6:46 PM, Woonsan Ko <woon_...@yahoo.com> > wrote: > > > Hi, > > > > I think you can make use of Portlet 2.0 Head Element > Contribution. Also see > > [1]. > > > > [1] > > http://mail-archives.apache.org/mod_mbox/portals-jetspeed-user/201101.mbox/%3c771436.89975...@web112814.mail.gq1.yahoo.com%3E > > > > Woonsan > > > > --- On Thu, 4/21/11, anyz <anyz...@gmail.com> > wrote: > > > > > From: anyz <anyz...@gmail.com> > > > Subject: JSP include and multiple portlets > Problem > > > To: "Jetspeed Users List" <jetspeed-user@portals.apache.org> > > > Date: Thursday, April 21, 2011, 3:04 PM > > > I have multiple JSP portlets on a > > > PSML page. Each JSP portlet page uses > > > common code by including various common JSP > files. > > > > > > Thus common JSP files are actually included > multiple times > > > in one PSML page > > > due to multipel portlets including these. It > creates many > > > issues including > > > Javascript code that is over written by > portlets. > > > > > > What should be best approach to include common > jsp files > > > only once. May be > > > some sort of conditionall inclusion or J2 has > some > > > recommended way to do > > > this. > > > > > > Thanks > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org > > For additional commands, e-mail: jetspeed-user-h...@portals.apache.org > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org For additional commands, e-mail: jetspeed-user-h...@portals.apache.org