jford 2004/04/08 20:35:14
Added: tutorial/xdocs/8 index.xml registry.xml events.xml
customization.xml deploy.xml jsp.xml
actioncontext.xml jsptemplate.xml resolution.xml
Log:
Converted Chapter 8 of the tutorial to the xdoc format
Revision Changes Path
1.1 jakarta-jetspeed/tutorial/xdocs/8/index.xml
Index: index.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>JSP Portlet</title>
</properties>
<body>
<section name="JSP Portlet">
<p>
Tutorial 8 introduces the JSP Portlet. This section covers:
</p>
<p>
<ul>
<li>1. Introduction to JSP</li>
<li>2. JSP Portlets in the Registry</li>
<li>3. The JSP Template</li>
<li>4. Template Resolution</li>
<li>5. JSP Actions</li>
<li>6. Portlet Customization and Parameter Styles</li>
<li>7. JSP Actions</li>
<li>8. Deploy</li>
</ul>
</p>
<p>
Let's get started. From the JPortal distribution root directory, type:
</p>
<p>
<source>
<![CDATA[
ant tutorial-8
]]>
</source>
</p>
<p>
Recommend bringing up these files in your editor:
</p>
<p>
<ul>
<li>1. webapp/WEB-INF/conf/t8-portlets.xreg</li>
<li>2. src/java/com/bluesunrise/jportal/modules/actions/portlets/
TutorialStockQuoteAction8.java</li>
<li>3. webapp/WEB-INF/templates/jsp/portlet/html/TutorialStockQuote8.jsp</li>
</ul>
</p>
<p>
since we will reference them in tutorial 8.
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/registry.xml
Index: registry.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>JSP Portlets in the Registry</title>
</properties>
<body>
<section name="JSP Portlets in the Registry">
<p>
JSP Portlets are defined like any other portlet: in the portlet registry.
In tutorial 8 we define one new portlet:
</p>
<p>
<source>
<![CDATA[
<portlet-entry name="TutorialStockQuote8" hidden="false" type="ref"
parent="JSP" application="false">
...
<parameter name="template" hidden="true"
value="TutorialStockQuote8.jsp"/>
<parameter name="action" hidden="true"
value="portlets.TutorialStockQuoteAction8" />
...
</portlet-entry>
]]>
</source>
</p>
<p>
When defining a JSP portlet, there are two required parameters: the <b>template</b>
and the <b>action</b>.
The template defines the JSP template which will generate the portlet content.
It is your MVC View component.
The action is the controller, and it has several responsibilities including handling
action events and populating the request attributes.
The templates should be placed in the portlets subdirectory of one of your JSP
template paths.
The action is placed in the module path, conventionally under the portlets directory
of the root actions directory.
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/events.xml
Index: events.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>JSP Events</title>
</properties>
<body>
<section name="JSP Events">
<p>
Action events allow you tie events that occur on the user interface, such as a form
being submitted, or a button clicked, to post back to a specific event handler on a <a
href="http://portals.apache.org/jetspeed-1/apidocs/org/apache/jetspeed/modules/actions/portlets/JspPortletAction.html">JspPortletAction</a>
class.
</p>
<p>
Although our example uses a single action event ("refresh"), it is possible to use
multiple events per portlet. In short, declaring an action event involves:
</p>
<p>
<ul>
<li>1. Specifying the name of your JspPortletAction as using a hidden input field
called "action",</li>
<li>2. Defining a submit button named with the following convention:
"eventSubmit_{action-name}",</li>
<li>3. Declaring an event handler in your JspPortletAction called {action-name}.</li>
</ul>
</p>
<p>
For example:
</p>
<p>
<source>
<![CDATA[
<form method="post" action="<jetspeed:dynamicUri/>">
<input type="hidden" name="js_peid" value="<%=jspeid%>">
<input type="hidden" name="action" value=" portlets.myJspPortletAction"/>
<input type="submit" name="eventSubmit_doUpdate" value="Save"/>
]]>
</source>
</p>
<p>
<source>
<![CDATA[
public void doUpdate(RunData rundata, Portlet portlet) throws Exception
{
// action logic goes here
}
]]>
</source>
</p>
<p>
You may refer to the following <a href="../7/events.html">section</a> in <a
href="../7/index.html">Tutorial 7</a> for an example of using action events.
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/customization.xml
Index: customization.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>Portlet Customization and Parameter Styles</title>
</properties>
<body>
<section name="Portlet Customization and Parameter Styles">
<p>
Please review the following <a href="../7/customization.html">section</a> in <a
href="../7/index.html">Tutorial 7</a> on the process of portlet customization and
usage of parameter styles.
You will find that Velocity and JSP Portlets work identically in that respect.
You will also find additional information about parameter styles in <a
href="../12/index.html">Tutorial 12</a>.
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/deploy.xml
Index: deploy.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>Deploy</title>
</properties>
<body>
<section name="Deploy">
<p>
To deploy the system, type:
</p>
<p>
<source>
<![CDATA[
ant deploy (or hotdeploy)
]]>
</source>
</p>
<p>
Use hotdeploy if you have already deployed the system once. This simply saves some
time in packaging the JPortal deployment. Next point your browser at:
</p>
<p>
<a
href="http://localhost:8080/jportal/portal">http://localhost:8080/jportal/portal</a>
</p>
<p>
You should see the new JSP portlet in the default pane:
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/jsp.xml
Index: jsp.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>Introduction to JSP</title>
</properties>
<body>
<section name="Introduction to JSPt">
<p>
<a href="http://java.sun.com/products/jsp/">JSP</a> (Java Server Pages) is a
technology based on the Java language and enables the development of dynamic web
sites.
JSP was developed by Sun Microsystems to allow server side development.
JSP files are HTML files with special Tags containing Java source code that provide
the dynamic content.
JSP is easy to learn and allows developers to quickly produce web sites and
applications in an open and standard way.
JSP offers a robust platform for web development.
</p>
<p>
<ul>
<li>1. Multi platform</li>
<li>2. Component reuse by using JavaBeans and EJB.</li>
<li>3. Separation of content from code</li>
<li>4. You can take one JSP file and move it to another platform, web server or JSP
Servlet engine.</li>
</ul>
</p>
<p>
Jetspeed has a JSP templating service built directly into the Jetspeed engine.
Similar to Velocity, you can base your portlets on JSP. This means that your portlets
will also follow the MVC design pattern, separating content from code.
</p>
<p>
The examples in Tutorial 5 and Tutorial 6 were useful for you to learn the Portlet
interface. However, overriding the getContent method of the portlet interface is not
good practice.
We recommend abstracting the content generation phase by basing your portlets on one
of the MVC-based portlets provided in the Jetspeed distribution;
such as
<a
href="http://portals.apache.org/jetspeed-1/portlet_config_Velocity.html">VelocityPortlet</a>,
<a
href="http://portals.apache.org/jetspeed-1/portlet_config_JSP.html">JSPPortlet</a>,
<a
href="http://portals.apache.org/jetspeed-1/portlet_config_XSL.html">XSLTPortlet</a>,
<a
href="http://portals.apache.org/jetspeed-1/portlet_config_RSS.html">RSSPortlet</a> or
<a
href="http://portals.apache.org/jetspeed-1/portlet_config_HTML.html">HTMLPortlet</a>.
</p>
<p>
A JSP portlet is made up of the typical MVC components:
</p>
<p>
<table>
<tr>
<td>MVC Component</td>
<td>JSP Component</td>
</tr>
<tr>
<td>Model</td>
<td>Java Objects put in as request attributes</td>
</tr>
<tr>
<td>View</td>
<td>Template</td>
</tr>
<tr>
<td>Controller</td>
<td>Your JSP Action</td>
</tr>
</table>
</p>
<p>
The controller is your JSP Action class.
The base <a
href="http://portals.apache.org/jetspeed-1/portlet_config_JSP.html">JspPortlet</a>
class should rarely have to be modified.
Your view is a JSP template, which will generate the content of your portlet by
pulling out dynamic model information from the request attributes.
In addition to the standard JSP variables (request, response, session, etc), the
following variables are available in the model:
</p>
<p>
<table>
<tr>
<td>Variable</td>
<td>Type</td>
<td>Description</td>
</tr>
<tr>
<td>rundata</td>
<td>RunData</td>
<td>Reference to request run data object</td>
</tr>
<tr>
<td>js_peid</td>
<td>String</td>
<td>Portlet unique identifier</td>
</tr>
<tr>
<td>link</td>
<td>JspLink</td>
<td>Instance of JspLink object</td>
</tr>
<tr>
<td>portlet</td>
<td>Portlet</td>
<td>Reference to this portlet object</td>
</tr>
</table>
</p>
<p>
These can be retrieved from request attributes as in the example below:
</p>
<p>
<source>
<![CDATA[
String jspeid = (String) request.getAttribute("js_peid");
]]>
</source>
Also, your JSP template can make use of any of the available tags from the Jetspeed
tag library. See <b>JSP1_1andJetspeedTagLibrary</b> portlet for comprehensive list of
examples.
</p>
<p>
The getContent method of the JspPortlet should never be edited. All content is
generated by the template, as designed in our MVC design pattern.
</p>
<p>
The Life Cycle phases of a portlet are also enhanced with the JSP portlet.
</p>
<p>
<table>
<tr>
<td>Phase</td>
<td>Method</td>
</tr>
<tr>
<td>Init</td>
<td>Init</td>
</tr>
<tr>
<td>ProcessAction</td>
<td>JSP Portlet Action and Action Events</td>
</tr>
<tr>
<td>Render</td>
<td>Template is called by JSP Portlet</td>
</tr>
<tr>
<td>Destroy</td>
<td>--none--</td>
</tr>
</table>
</p>
<p>
JSP portlets are really about dynamic content.
If you have static content, there is no real benefit to using a JSP portlet;
take a look at one of the static content generation portlets such as the <a
href="http://portals.apache.org/jetspeed-1/portlet_config_HTML.html">HTMLPortlet</a>
instead. The basic function of JSP is really very simple, it substitutes live Java
objects into a JSP template.
There is an online tutorial with great examples <a
href="http://www.visualbuilder.com/jsp/tutorial/default.asp">here</a>.
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/actioncontext.xml
Index: actioncontext.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>JSP Portlet Actions</title>
</properties>
<body>
<section name="JSP Portlet Actions">
<p>
JSP Portlet Actions are Java classes, they are where you put your controlling logic
for your code. Here you will do any backend processing necessary to retrieve or store
dynamic information, and then populate the JSP request attributes with your model so
that the template may display the dynamic content.
</p>
<p>
First, let’s look at the code for the <b>TutorialStockQuoteAction8</b>.
This portlet retrieves stock quotes from a web service.
There is only one method in this JSP portlet action, the <a
href="http://portals.apache.org/jetspeed-1/apidocs/org/apache/jetspeed/modules/actions/portlets/JspPortletAction.html#buildNormalContext(org.apache.jetspeed.portal.Portlet,%20org.apache.velocity.context.Context,%20org.apache.turbine.util.RunData)">buildNormalContext</a>
method.
The <a
href="http://portals.apache.org/jetspeed-1/apidocs/org/apache/jetspeed/webservices/finance/stockmarket/StockQuoteService.html">StockQuoteService</a>
comes with the Jetspeed deployment.
It returns an array of <a
href="http://portals.apache.org/jetspeed-1/apidocs/org/apache/jetspeed/webservices/finance/stockmarket/StockQuote.html">StockQuote</a>
objects when you ask for a quote on a array of stock symbols.
</p>
<p>
<source>
<![CDATA[
public class TutorialStockQuoteAction8 extends JspPortletAction
{
private static final String SYMBOLS = "symbols";
private static final String COLUMNS = "columns";
private static final String QUOTES = "quotes";
private static final String[] ALL_COLUMNS = {"Symbol","Price","Change","Volume"};
/**
* Build the normal state content for this portlet.
*
* @param portlet The jsp-based portlet that is being built.
* @param rundata The turbine rundata context for this request.
*/
protected void buildNormalContext(Portlet portlet,
RunData rundata)
{
try
{
// Get reference to stock quote web service
StockQuoteService service = (StockQuoteService)
TurbineServices.getInstance().
getService(StockQuoteService.SERVICE_NAME);
// Retrieve portlet parameters
String symbols = (String)
PortletSessionState.getAttributeWithFallback(portlet, rundata, SYMBOLS);
// Request stock quote(s) from the stock quote web service
String[] symbolArray = StringUtils.stringToArray(symbols, ",");
StockQuote[] quotes = service.fullQuotes(symbolArray);
// Place appropriate objects in jsp context
rundata.getRequest().setAttribute(QUOTES, quotes);
rundata.getRequest().setAttribute(COLUMNS, ALL_COLUMNS);
}
catch (Exception e)
{
Log.error(e);
}
}
}
]]>
</source>
</p>
<p>
The above example is very similar to the one used in <a
href="../7/index.html">Tutorial 7</a> with the exception that it allows the user to
temporarily specify stock quote symbols without having to customize. Note that the
symbols are retrieved by the portlet action as follows:
</p>
<p>
<source>
<![CDATA[
String symbols = (String) PortletSessionState.getAttributeWithFallback(portlet,
rundata, SYMBOLS);
]]>
</source>
</p>
<p>
The above method call retrieves value of the symbols parameter using the following
algorithm:
</p>
<p>
<ul>
<li>1. If the parameter is present in the request, get it from there and store it in
the session, otherwise,</li>
<li>2. If the parameter is present in the session, get it from the session,
otherwise,</li>
<li>3. If the parameter is present in portlet instance attributes (values defined
for the portlet in user psml), get it from there, otherwise,</li>
<li>4. Get if from the portlet configuration (values defined for the portlet in
registry)</li>
</ul>
</p>
<p>
So when the user "overrides" the stock symbols using the input field provided within
the body of the portlet, the portlet will temporarily display stock quotes for those
symbols until:
</p>
<p>
<ul>
<li>1. The user logs of and logs back in</li>
<li>2. The user clicks the “Get Quotes” button with empty input field</li>
<li>3. The user customizes the portlet</li>
</ul>
</p>
<p>
Now, let’s take a closer look at the <a
href="http://portals.apache.org/jetspeed-1/apidocs/org/apache/jetspeed/modules/actions/portlets/JspPortletAction.html">JspPortletAction</a>
class,
and see how the processAction phase is nicely handled for you by inheriting from
this class.
There are three important methods than you can implement in your velocity action.
Remember from section <a href="../6/lifecycle.html">6.2 on the Portlet Life
Cycle</a>, the processAction phase occurs before the render phase.
So the following methods will be called before the template is processed, allowing
for you to cleanly populate the JSP request attributes first, depending on the portlet
<a href="../6/modes.html">mode</a>.
</p>
<p>
<table>
<tr>
<td>Method</td>
<td>Portlet Mode</td>
</tr>
<tr>
<td>BuildNormalContext</td>
<td>View</td>
</tr>
<tr>
<td>buildConfigureContext</td>
<td>Customize (Edit)</td>
</tr>
<tr>
<td>buildMaximizedContent</td>
<td>Maximize</td>
</tr>
</table>
</p>
<p>
Using this approach you can easily customize your portlet to generate different
content depending on the mode of the request.
Often, the maximize content is the same as the normal context.
In the default implementation of <b>buildConfigureContext</b>, the normal context is
called.
You can override this method to specially handle maximize mode.
The <b>buildConfigureContext</b> is available if you want to provide your own
customization as we will do further on in this chapter.
To go with the default portal customizer provided by Jetspeed, just don’t override
this method.
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/jsptemplate.xml
Index: jsptemplate.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>The JSP Template</title>
</properties>
<body>
<section name="The JSP Template">
<p>
Let's have a look at the JSP template from our example:
<b>TutorialStockQuote8.jsp</b> It's a very simple example of displaying live stock
quotes from a web service. The stock quotes are returned in a collection of quote
records and stored in request attribute called �quotes�. Also, the column headers
are in a collection of strings and stored in a request attribute called �columns�.
</p>
<p>
<source>
<![CDATA[
<%@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' %>
<%@ page import = "org.apache.turbine.util.Log" %>
<%@ page import = "org.apache.jetspeed.webservices.finance.stockmarket.StockQuote" %>
<%
try{
StockQuote[] quotes = (StockQuote[]) request.getAttribute("quotes");
String[] columns = (String[]) request.getAttribute("columns");
String jspeid = (String) request.getAttribute("js_peid");
%>
<FORM METHOD="POST">
<INPUT TYPE="hidden" NAME="js_peid" VALUE="<%=jspeid%>">
Enter symbol(s) separated with commas: <input name="symbols" type="TEXT"><INPUT
TYPE="SUBMIT" NAME="refresh" VALUE="Get Quotes">
</FORM>
<table>
<tr>
<td>
<table border="true" cellspacing="1" cellpadding="3">
<tr>
<%for (int i = 0; columns != null && i < columns.length; i++) {%>
<TH><%=columns[i]%></TH>
<%}%>
</tr>
<%for (int j = 0; quotes != null && j < quotes.length; j++) {%>
<tr>
<TD><%=quotes[j].getSymbol()%></TD>
<TD><%=quotes[j].getPrice()%></TD>
<TD><%=quotes[j].getChange()%></TD>
<TD><%=quotes[j].getVolume()%></TD>
</tr>
<%}%>
</table>
</td>
</tr>
</table>
<%} catch (Exception e) {
Log.error(e);
return;
}%>
]]>
</source>
</p>
<p>
Also, you will note that one additional request attribute is retrieved:
<b>jspeid</b>.
The value of this attribute is used to define a hidden field "js_peid" which
uniquely identifies this portlet when its form is submitted via the "refresh" button:
</p>
<p>
<source>
<![CDATA[
<INPUT TYPE="hidden" NAME="js_peid" VALUE="<%=jspeid%>">
]]>
</source>
</p>
<p>
Adding the above field in your template assures that when multiple instances of the
portlet are used on the same pane, the refresh will only apply to particular portlet
instance.
This concept applies to Velocity portlets as well.
</p>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/8/resolution.xml
Index: resolution.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>Template Resolution</title>
</properties>
<body>
<section name="Template Resolution">
<p>
Where should templates be placed in the web application?
By convention, Jetspeed looks for JSP Portlet templates in the Jetspeed deployment
under <b>/WEB-INF/templates/jsp/portlets/html</b> (for HTML portlets).
Similarly, WML portlets would be found under
<b>/WEB-INF/templates/jsp/portlets/wml</b>.
The resolution of portlet templates is based on several configuration files and a
resolution algorithm.
</p>
<p>
The <b>TurbineResources.properties</b> is where the first part of the configuration
goes:
</p>
<p>
<source>
<![CDATA[
services.JspService.templates = /WEB-INF/templates/jsp, /WEB-INF/mytemplates/jsp
]]>
</source>
</p>
<p>
You can specify multiple paths by comma-separating the paths.
Secondly, the <b>JetspeedResources.properties</b> must be updated with the same
path, but to root directory containing all templates (both JSP and VM).The list may
also be comma-separated.
</p>
<p>
<source>
<![CDATA[
services.TemplateLocator.templateRoot=/WEB-INF/templates,/WEB-INF/mytemplates
]]>
</source>
</p>
<p>
The template resolution algorithm finds the template. The resolver is a service and
is pluggable. The default service has a resolution algorithm much like how the
Profiler service resolves PSML resources.
</p>
<p>
Templates resources may be optionally localised. Templates are localized by placing
them in sub-directories based on language and country code abbreviations. The
language-code sub-directory contains one or more country-code subdirectories.
</p>
<p>
The language-code directory name is specified with an ISO-639 standard two-character
language abbreviation. The country-code subdirectory is optional, and is specified
with an IS0-3166 standard two-character country code abbreviation.
</p>
<p>
An example:
</p>
<p>
<source>
<![CDATA[
jsp
|-- portlets
|-- html
|-- fr // french language
|-- FR // France country-code
|-- BE // Belgium country-code
]]>
</source>
NOTE: The country codes must be in upper-case
</p>
<p>
For a given locale of fr_FR, and an HTML request, the search order for a template
named grenouille.jsp would be:
</p>
<p>
<source>
<![CDATA[
jsp/portlets/html/fr/FR/grenouille.jsp
jsp/portlets/html/fr/grenouille.jsp
jsp/portlets/html/grenouille.jsp
jsp/portlets/grenouille.jsp
]]>
</source>
</p>
<p>
The template locator looks at the "Content Language" HTML header for locale specific
settings. If there are multiple settings, all settings will be searched until the
first resource is found. (This is currently not supported)
</p>
<p>
For a complete list of ISO-639 standard language abbreviations, see:
</p>
<p>
<a
href="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
</p>
<p>
For a complete list of ISO-3166 standard country code abbreviations, see:
</p>
<p>
<a
href="http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
</p>
</section>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]