PageBuilder2 theme architecture - Dynamic Content Spot

In the PageBuilder2 theme architecture - theme.html i mentioned that the theme.html makes use of concept of dynamic content spot. The basic concept is that the theme.html want to include .jsp page, since the .html page cannot directly add .jsp page since .jsp pages need servlet context to compile and execute, those .jsps are packaged in the PageBuilder2.war along with Default.jsp.



Ex. the theme.html wants to forward control to asa.jsp for generating active sight analytics(asa) related markup, so you can include that .jsp in the theme.html like this

<a rel="dynamic-content"
href="res:/PageBuilder2/themes/html/PageBuilder2.0/asa.jsp"></a>


But this approach has following problems

  • Reference by name abstracts the dynamic content away from the implementation. This is necessary if the theme needs to run on multiple runtimes, for example WebSphere Portal and IBM® Mashup Center. The portal implementation of the navigation tabs can be a JSP that contains portal specific code. The Mashup Center on the other hand cannot execute portal JSP code, but provides an iWidget instead.

  • Reference by name isolates the theme author from having to know the underlying code information. This is useful if the theme author is an HTML and CSS designer, but not a J2EE or JavaScript developer. The HTML and CSS developer needs to know only the list of named content spots and the simple syntax to add it. This developer can then write code without having to know JSP path names etc.



So in order to provide one more layer of indirection, WPS has WP_DynamicContentSpotMappings resource provider that lets you map a symbolic name to the location of .jsp like this




Now inside your theme.html you can refer to the asa.jsp like this

<a rel="dynamic-content" href="dyn-cs:id:asa@tl:oid:csa2.theme" />


The resolver framework takes care of finding the actual .jsp file from this symbolic name. Also if you start digging into the .jsp files you will notice that they also include other .jsps by using this type of syntax


<r:dataSource uri="dyn-cs:id:configGlobal@tl:oid:csa2.theme" escape="none">
<r:param name="pragma" value="cache"/>
</r:dataSource>
<r:dataSource uri="dyn-cs:id:configDynamic@tl:oid:csa2.theme" escape="none"/>

7 comments:

Daniele Vistalli said...

Great stuff, thank you for your articles.

From the docs it "seems" that you could also define dynamic content spot aliases at theme level in metadata.

This should save time over the resource environment method.

Unfortunately I couldn't figure out the correct way to do it.

I'll go for a PMR and ask IBM.

The reference is in this infocenter page:

http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Working_with_dynamic_content_spots_wp7

the last section is about using metadata.

I tried this but got stuck. Webdav is always trashing away my changes.

Any idea ?

portallead said...

I like to access WCM API in theme, like I wanted to show WCM navigation component in theme along with normal portlet navigation. It is possible?. pls send me reply on portallead@gmail.com

Sunil Patil said...

Take a look at http://wpcertification.blogspot.com/2010/10/using-custom-dynamic-content-spot-in.html for information on how to use dynamic content spot.

I think you should be able to change the navigation related jsp to include your own content in navigation

Sergio said...

I couldn't access those metadata files using webdav, neither through the /themelist/all URL nor the /fs-type1 URL. The wabdav get redirected all the time and cannot download those files. Does anyone else have the sense that webdav is not working properly with wp7?

Anonymous said...

hi, how do i create a new pagebuilder theme from the mashup theme. i understand that the existing pagebuilder theme is in "C:\IBM\WebSphere7\PortalServer\theme\wp.mashup.cc.theme\installedApps\wp.mashup.cc.theme.ear\PageBuilder2.war"
i do not wish to edit the existing default.jsp file

Geetha Devi said...

It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving... very specific nice content.java training in chennai | java training institutes in chennai | java j2ee training institutes in velachery

vigneswaran said...

Amazing tutorial.We share this info very helpful to us.I read now this tutorial very interesting. Java world popular developer work and Mostly IT People working background for Java Developer.Thanks for this useful tutorial.
Selenium Training in Chennai | Selenium Training Course in Chennai | Java Training in Chennai | Best Java Training Institute in Chennai