Skip to main content


Showing posts from October, 2012

Enabling JSTL Support in JSP Templating

In my recent efforts on writing a Java Mediator for SDLTridion templating, I have now reached the point where I can write Template Building Blocks in JSP . Next is to enable JSTL support in the JSP TBB. That means to be able to use the Java Standard Tag Library (JSTL) and Expression Language (EL) in my JSP TBBs. This functionality allows the following in a JSP TBB: declare a taglib in my JSP with a given prefix. The interesting part is the uri  attribute -- which comes from the TLD (Tag Library Definition) file. For JSTL, the .tld files are contained in the JAR itself, under path META-INF/ . Each uri  identifies a unique .tld file. This way, the J2EE engine knows which .tld to load, and therefore, which implementation classes, tags and method signatures are available within that TLD; use EL to read variables from the package . Yes, it is cool! In the example below, expression ${UserName} reads the item with name UserName from the package and outputs its value; Running th

JSP Template Building Block

Continuing on my quest for creating a Java Mediator for Tridion templating, I have now reached the moment when I would focus on a JSP TBB. Check out my previous post about Java Fragment TBB and how to validate its syntax/compilation capability. The JSP TBB is meant to provide the same functionality as a Dreamweaver TBB, only in Java/JSP technology. So I had in mind the following requirements: JSP support (write the TBB in JSP syntax); compile JSP to Java source file; compile Java source to byte-code; execute Java compiled class in the context of Engine and Package objects; create " Output " package item containing the result of JSP execution; The following is a sample of JSP Layout TBB for a Page Template. Note: The objects Engine and Package are available in the ' request '; There is no real ' request ' object as the entire JSP code-above does not run in or require a J2EE container -- the request is a FakeHttpServletRequest , but more o