I need to include some body element. Ok, if i use <jsp:include/> action in two protlets on single PSML page. The resultant HTML of each portlet will contain that common code included through <jsp:include/> action. Ultimately the final HTML rendered to browser will have that included code twice in contents.
Right? On Tue, Apr 26, 2011 at 4:33 PM, Woonsan Ko <woon_...@yahoo.com> wrote: > Maybe I'm not understanding your problem exactly, but why do you need to > JSP include directives? Because it merges the sources, you can always meet > that compilation problem. > If you want to contribute header elements, you'd better use Portlet 2.0 > header contribution feature. > If you want to include some body elements only once with a common jsp page, > you can even use JSP include action, <jsp:include />. > Anyway, it's up to you, but it seems error prone to include some common > code blocks with JSP include directives. > > Woonsan > > > --- On Tue, 4/26/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: Tuesday, April 26, 2011, 8:07 AM > > Basically what it means is output of > > one JSP portlet is not available to > > other. So each has to include common/header files > > separately resulting in > > duplicate code in final output sent to browser. > > > > > > > > > > On Tue, Apr 26, 2011 at 11:06 AM, anyz <anyz...@gmail.com> > > wrote: > > > > > It worked exactly same way you described. However what > > i understood from J2 > > > working is below: > > > > > > Say there are two JSP protlets on page. J2 will call > > two JSP separately , > > > accumulate two outputs into resultant page and send > > back to browser. Though > > > two portlets are part of same RequestContext but both > > JSP are compiled > > > separately without knowing each other. > > > > > > Thus each JSP have to include common/header JSP files > > otherwise it is not > > > compiled giving varibale not found exceptions that are > > defined in common > > > header jsp. > > > > > > Conclusion: Common header JSP files have to be > > included in each JSP portlet > > > page. This will produce duplicate code in resultant > > page at end. Can not > > > avoid it. > > > > > > > > > > > > > > > > > > On Mon, Apr 25, 2011 at 4:03 PM, Woonsan Ko <woon_...@yahoo.com> > > wrote: > > > > > >> > > >> --- On Mon, 4/25/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: Monday, April 25, 2011, 6:57 AM > > >> > Thanks, it is very helpful > > >> > configuring portlet speicifc JSP header > > pages > > >> > using init params. > > >> > > > >> > I also thought of using portlet filter. This > > portlet filter > > >> > will set a > > >> > portlet session variable if it finds a > > portlet with common > > >> > headers. And in > > >> > common header files we can check this flag > > variable to > > >> > include the code or > > >> > not. Howerver once set we need to remvoe it > > when filter is > > >> > called for last > > >> > Portlet on PSML page so that next time PSML > > page is called > > >> > it can include > > >> > header files. > > >> > > > >> > I dont' think its possibel to detect last > > portlet on PSML > > >> > page in Portlet > > >> > Filter. It is like setting a flag in *PSML > > Page Level > > >> > Scope*. > > >> > > >> If it is okay with Jetspeed-2 specific API, then > > you can make use of > > >> RequestContext object which is a flyweight object > > only for the current page > > >> request: > > >> > > >> import > > org.apache.jetspeed.request.RequestContext; > > >> > > >> RequestContext requestContext = (RequestContext) > > >> > > portletRequest.getAttribute(RequestContext.REQUEST_PORTALENV); > > >> > > >> Because requestContext is shared among portal and > > portlets, you may use > > >> #setAttribute() and #getAttribute() and you don't > > have to remove attributes > > >> later in this case. requestContext object will be > > removed after the request. > > >> > > >> Woonsan > > >> > > >> > > > >> > > > >> > > > >> > > > >> > On Fri, Apr 22, 2011 at 7:17 PM, Woonsan Ko > > <woon_...@yahoo.com> > > >> > wrote: > > >> > > > >> > > > > >> > > --- 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 > > >> > > > > >> > > > > >> > > > >> > > >> > > --------------------------------------------------------------------- > > >> 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 > >