Hi dev_list folks, I would like to know, if there is an easy way, to instantiate a Jahia portlet without having to select and configure it in the container popup. I would need is, several pages of our portal application automatically contain one specific portlet. To be more concrete: We have a category tree, and when the user browses through the category tree in each category leaf, there should be a different Poll. (We are using a modified version of the Jahia Poll Portlet). In each category there should be a different poll, so the portlet needs to be instance aware (I think we have made it, using the Jahia portlet APIs contextId request parameter)
The usual way is to add a Jahia field of type application with some approriate update container links and let the administrator add and configure the portlet. But we want that the portlet (poll) is already there, when a new page is created!? We have tried a solution similar to an posting from the template dev list (http://list.jahia.org/template_list/msg00740.html) This solution is based upun absolute fields and it goes like this: > in your homepage.jsp template : > // declare once the field > <content:declareField name="fixedWebapp" title="fixedWebapps" > type="Application"/> > <content:applicationField name="fixedWebapp" id="fixedWebapp"/> > <a href="<content:updateFieldURL fieldName='fixedWebapp'/>">[Update]</a> > > then in other reffering templates : > // use the pageLevel attribute to point to the field defined at the home > page > <content:applicationField name="fixedWebapp" id="fixedWebapp" > pageLevel="1"/> > <a href="<content:updateFieldURL fieldName='fixedWebapp'/>">[Update]</a> > > But you probably need to define an expiration delay to avoid caching of your > webapp output. We have encountered some problems with this solution, e.g. the servlet's service method of the portlet is called more than once per request (see also http://www.mail-archive.com/[email protected]/msg00274.html) and it produces therefore different output, in live/preview and edit mode?! Is there maybe another solution, or can I maybe restrict the selectable portlets, so that administrators can not chose the wrong one? kind regards Wilhelm Berger
