Anchor | ||||
---|---|---|---|---|
|
In This Section
Table of Contents | ||
---|---|---|
|
...
This section covers the details of the 6 steps you performed in the Design in 6 Steps - 1. It will explain more about JSPs and their relation to XperienCentral.
Contents of a JSP
A JSP file contains simply the (X)HTML (or XML) that is requested. JSP directives allow the use of so-called tag libraries. To use the core functions of the JSP Standard Tag Library (JSTL), the following directive should be placed at the beginning of the file:
...
The best way to become familiar with these expressions is to experiment with printing various properties of the design presentationcontext
, website, page and pageVersion
objects (see the XperienCentral Javadoc).
JSP Guidelines
Because the JSP and XperienCentral API also connect to other XperienCentral modules, for example the caching mechanism, it is important to learn more about what you should and shouldn’t do while working with JSPs. If you neglect this the performance of your site may be significantly slower because the caching or personalization mechanisms cannot perform well with the JSPs.
...
Start every JSP that should in any way be able to cache with the JSP directive:
Code Block theme Eclipse <%@ page language="java" session="false" buffer="none" %>
- Include only those tag libraries that are necessary.
Avoid as much as possible non-XML compliant JSPs, such as:
Code Block theme Eclipse <a href="<c:out value="${link.url}"/>">title</a>
GX uses JSP Version 2.0 which contains an improved version of the Expression Language (EL), and allows the above to be written as follows:
Code Block theme Eclipse <a href="${link.url}">title</a>
The content of JSPs has to conform to the following JSP code conventions
http://java.sun.com/developer/technicalArticles/javaserverpages/code_conventio
http://www.oracle.com/technetwork/java/codeconvtoc-136057.html
Don'ts
- JSPs are designed to contain HTML and scripting code, not Java code. In combination with the special
<% %>
tag (the so-called scriptlets), it is possible to include Java code in the JSP. Try to avoid using these scriptlets because this conflicts with the separation of content, business logic and the design template and it may conflict with the caching mechanism. - Don’t use the
<jsp:include>
tag to include a JSP. Instead use the XperienCentral alternative:<wm:includeUrl url=""/>
. - Don’t mix XperienCentral sessions with common Java sessions.
XML Descriptor File
To connect a JSP to XperienCentral, a design template descriptor has to be defined. The design template descriptor – in XML format – identifies the JSP for XperienCentral. Almost every JSP has its own descriptor. XperienCentral reads the design template descriptors when you upload the plugin.
...
Tag | Note | Description |
---|---|---|
| Required | The unique internal name for the design template. |
| Required | The name shown in the drop-down list for the element. |
| Several are possible | Specifies for which part in XperienCentral the descriptor is intended. |
| Optional | Disk location of the handling JSPF for the server side include version. |
| Optional and several are possible | Definitions of the options to be configured in XperienCentral. |
| Optional and several are possible | Definitions of the channels. |
Property Tags, Design Template Variants and Styles
In order to add the options for editors to a JSP, properties have to be specified in the design template descriptor. This is done using a property tag under the design template tag. For example:
...
The integer
, string
, and boolean
data types make it possible to configure the JSPs without having to use Java code. If possible, create a pagemetadata
plugin if you want to assign specific objects to a page.
Special case: separator properties
The Community Edition "Content" pagepart
design template contains two design template properties (fromSeparator
and toSeparator
) that specify the range of the elements to be printed. These properties are related to the separators. It is not necessary to retrieve the values of these properties using the <wm:Design templateProperty-tag
, when you retrieve the elements - the method will automatically use these values.
Channel Tag
XperienCentral can render a page as a PDF document send pages as newsletters and send special pages to mobile devices. Using channel design templates, it is possible to create a single page and use multi-channel publishing to make the content viewable by all possible devices.
...