[cvs] Expresso commit by mtraum: added velocity docs
JCorporate Ltd
jcorp at jcorp2.servlets.net
Fri Oct 8 12:19:06 PDT 2004
Log Message:
-----------
added velocity docs
Modified Files:
--------------
expresso/expresso-web/expresso/doc/edg:
jsp.xml
Revision Data
-------------
Index: jsp.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/edg/jsp.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -Lexpresso-web/expresso/doc/edg/jsp.xml -Lexpresso-web/expresso/doc/edg/jsp.xml -u -r1.21 -r1.22
--- expresso-web/expresso/doc/edg/jsp.xml
+++ expresso-web/expresso/doc/edg/jsp.xml
@@ -1,7 +1,6 @@
<chapter id='jsp' xreflabel='jsp'>
<title>Developing The View in the MVC</title>
<para>
-
<note>
<para>
If you find this EDG documentation helpful please consider <link linkend='donate_jsp'>DONATING</link>!
@@ -10,7 +9,6 @@
</note>
</para>
<para>
-
<informaltable colsep='0' frame='none' pgwide='1' rowsep='0'>
<tgroup cols='2' colsep='0' rowsep='0'>
<colspec align='left' colsep='0' colwidth='50%' rowsep='0' />
@@ -56,7 +54,6 @@
to the application server:
</para>
<para>
-
<itemizedlist>
<listitem>
<para>
@@ -166,8 +163,7 @@
Before we get into the actual taglibs, a quick note should be made for
those of you that have never dealt much with JavaBean terminology. Consider
the following code:
- <programlisting><![CDATA[
-public class myBean {
+ <programlisting><![CDATA[public class myBean {
//Standard Read only property named 'var1'
private int var1 =233;
@@ -219,8 +215,7 @@
public String setValues(String key, String newValue) {
values.put(key,newValue);
}
-}
-]]></programlisting>
+}]]></programlisting>
</para>
<para>
Notice the naming pattern for the get/set values. You take the name of
@@ -239,11 +234,9 @@
not. However, a workaround can be made by exposing the underlying Map object,
which JSTL can work with. To add this compatibility layer, simply add the
method:
- <programlisting><![CDATA[
- public Map getValuesMap() {
+ <programlisting><![CDATA[public Map getValuesMap() {
return Collections.unModifiableMap(values);
- }
-]]></programlisting>
+ }]]></programlisting>
and you now have a read only Map that JSTL can work with but not mess up
the rest of your bean state.
@@ -299,8 +292,7 @@
Before we get started in this introduction, we need a sample ControllerResponse
to work with from the JSTL side. Out goal is to output the contents of
the ControllerResponse onto a jsp page.
- <programlisting><![CDATA[
-public Controller myController {
+ <programlisting><![CDATA[public Controller myController {
//declarations here
public ControllerResponse runMyState(ControllerRequest request,
@@ -347,8 +339,7 @@
response.add(t);
}
-}
-]]></programlisting>
+}]]></programlisting>
</para>
</sect2>
<sect2>
@@ -360,9 +351,7 @@
'content', that under the hood, the function getContent() is being called.
</para>
<para>
-
- <programlisting><![CDATA[
-<%@ taglib uri="/WEB-INf/tld/struts-logic.tld" prefix="logic"%>
+ <programlisting><![CDATA[<%@ taglib uri="/WEB-INf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>
@@ -431,8 +420,7 @@
</html:link>
</p>
</body>
-</html>
-]]></programlisting>
+</html>]]></programlisting>
</para>
</sect2>
<sect2>
@@ -475,9 +463,7 @@
'bean' becomes 'struts-bean' etc.
</para>
<para>
-
- <programlisting><![CDATA[
-<%@ taglib uri="/WEB-INf/tld/expresso-logic.tld" prefix="logic"%>
+ <programlisting><![CDATA[<%@ taglib uri="/WEB-INf/tld/expresso-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/tld/expresso-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/expresso-bean.tld" prefix="bean"%>
@@ -528,8 +514,7 @@
<html:exLink property="logout"/>
</p>
</body>
-</html>
-]]></programlisting>
+</html>]]></programlisting>
</para>
<para>
You may notice in this example, that many pieces are calculated automatically
@@ -611,8 +596,7 @@
For example, a number of rows of 'dropdown menu' are created by 'select'
tags below. Each dropdown menu is an Input, added to the 'row' block, and
each Input has a list of ValidValues which are its menu items.
- <programlisting><![CDATA[
-<table border="0" cellspacing="0" cellpadding="5">
+ <programlisting><![CDATA[<table border="0" cellspacing="0" cellpadding="5">
<c:forEach items="${controllerResponse.nestedMap['row'].nested}" var="oneBlock">
<tr>
<td>
@@ -625,40 +609,33 @@
</td>
</tr>
</c:forEach>
-</table>
-]]></programlisting>
+</table>]]></programlisting>
</para>
<para>
For a checkbox Input, we indicated the 'selected' attribute to indicate
check-ness:
- <programlisting><![CDATA[
-<input type="checkbox" class="mediumtext"
+ <programlisting><![CDATA[<input type="checkbox" class="mediumtext"
name="<c:out value="${oneInput.name}" />"
value="<c:out value="${oneInput.defaultValue}" />"
<c:if test="${not empty oneInput.attributes['selected']}"> CHECKED </c:if>
-/>
- ]]></programlisting>
+/>]]></programlisting>
</para>
<para>
For a checkbox Input, we use a 'selected' attribute to indicate checked-ness:
- <programlisting><![CDATA[
-<input type="checkbox" class="mediumtext"
+ <programlisting><![CDATA[<input type="checkbox" class="mediumtext"
name="<c:out value="${oneInput.name}" />"
value="<c:out value="${oneInput.defaultValue}" />"
<c:if test="${not empty oneInput.attributes['selected']}"> CHECKED </c:if>
-/>
-]]></programlisting>
+/>]]></programlisting>
</para>
<para>
A submit button requires two special tags:
- <programlisting><![CDATA[
-<input type="submit" name="<expresso_el:submitname value='${controllerResponse.namedTransitions['doScore']}'/>"
+ <programlisting><![CDATA[<input type="submit" name="<expresso_el:submitname value='${controllerResponse.namedTransitions['doScore']}'/>"
value="Save">
<expresso_el:buttonparams value="${controllerResponse.namedTransitions['doScore']}"
-/>
-]]></programlisting>
+/>]]></programlisting>
</para>
</sect2>
</sect1>
@@ -671,16 +648,576 @@
an example of this.
</para>
<para>
-
- <programlisting><![CDATA[
-<action path="/SampleController" type="org.example.myapp" name="default" scope="request" validate="false">
+ <programlisting><![CDATA[<action path="/SampleController" type="org.example.myapp" name="default" scope="request" validate="false">
<!-- this state forwards to a jsp -->
<forward name="start" path="/expresso/components/myapp/start.jsp"/>
<!-- this state forwards to a stylesheet for processing -->
<forward name="process" path="/expresso/components/myapp/process.xslt"/>
-</action>
-]]></programlisting>
+</action>]]></programlisting>
+ </para>
+ </sect1>
+ <sect1>
+ <title>Rendering ControllerResponse With Velocity</title>
+ <para>
+
+As of Expresso 5.6, Velocity can be used within Expresso. Velocity is a
+ <quote>simple yet powerful template language</quote>
+
+. If the developer wishes, Velocity and JSP can be used within the same
+application. For more information about Velocity, see <ulink url='http://jakarta.apache.org/velocity/index.html'>the
+Velocity homepage</ulink>.
</para>
+ <sect2>
+ <title>Configuring Velocity in Expresso</title>
+ <para>
+
+Velocity support is provided through an Expresso extension of Velocity's
+<ulink url='http://jakarta.apache.org/velocity/tools/view/'>VelocityView</ulink>
+tool. The following are required to enable velocity support:
+ <orderedlist>
+ <listitem>
+ <para>
+
+Download the <ulink url='http://jakarta.apache.org/velocity/tools/index.html'>VelocityTools</ulink>
+package. Copy the
+ <filename>velocity-dep-{version}.jar</filename>
+,
+ <filename>velocity-tools-{version}.jar</filename>
+, and
+ <filename>velocity-tools-view-{version}.jar</filename>
+files to
+ <filename>WEB-INF/lib</filename>
+. </para>
+ </listitem>
+ <listitem>
+ <para>
+Make sure the
+ <filename>/WEB-INF/velocity</filename>
+
+directory exists with all files. This is distributed with Expresso 5.6
+and above, but may not be present if upgrading from an older version.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Add the following to
+ <filename>web.xml</filename>
+:
+ <programlisting><![CDATA[<servlet>
+ <servlet-name>velocity</servlet-name>
+ <servlet-class>
+ org.apache.velocity.tools.view.servlet.VelocityLayoutServlet
+ </servlet-class>
+ <init-param>
+ <param-name>org.apache.velocity.toolbox</param-name>
+ <param-value>/WEB-INF/velocity/toolbox.xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>org.apache.velocity.properties</param-name>
+ <param-value>
+ /WEB-INF/velocity/velocity.properties
+ </param-value>
+ </init-param>
+ <load-on-startup>10</load-on-startup>
+</servlet>
+
+<servlet-mapping>
+ <servlet-name>velocity</servlet-name>
+ <url-pattern>*.vm</url-pattern>
+</servlet-mapping>]]></programlisting>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Velocity Global Macros for Expresso Integration</title>
+ <para>
+
+Several global macros have been defined to make using Velocity within Expresso
+easier.
+ <table>
+ <title>Expresso Global Macros</title>
+ <tgroup cols='3'>
+ <thead>
+ <row>
+ <entry>Macro Definition</entry>
+ <entry>Arguments</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <command>exp_string( $code )</command>
+ </entry>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term>code</term>
+ <listitem>
+ <para>
+The String to lookup
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry>Get a string from schema resources</entry>
+ </row>
+ <row>
+ <entry>
+ <command>exp_string_args( $code $args
+ )</command>
+ </entry>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term>code</term>
+ <listitem>
+ <para>
+The String to lookup
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry>Get a string from schema resources - supplying
+ replacement arguments</entry>
+ </row>
+ <row>
+ <entry>
+ <command>exp_element( $var $path )</command>
+ </entry>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term>var</term>
+ <listitem>
+ <para>
+variable to load the element into
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>path</term>
+ <listitem>
+ <para>
+path to search for the element, relative to the root
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry>
+Get a ControllerElement in the path relative to the
+ root <para>
+Examples:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <command>#exp_element( $myelement
+ "lists/groups/tests" )</command>
+ </para>
+ <para>
+returns the element named 'tests'
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <command>#exp_element( $myelement
+ "lists/groups/@style" )</command>
+ </para>
+ <para>
+returns the string for attribute 'style' in 'groups'
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <command>exp_elementFrom( $var $from $path
+ )</command>
+ </entry>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term>var</term>
+ <listitem>
+ <para>
+variable to load the element into
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>from</term>
+ <listitem>
+ <para>
+element to search for the element in
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>path</term>
+ <listitem>
+ <para>
+path to search for the element, relative to $from
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry>Get a ControllerElement in the path relative to the
+ supplied element. A leading / will make it relative to the
+ root</entry>
+ </row>
+ <row>
+ <entry>
+ <command>exp_content( $var $from $path
+ )</command>
+ </entry>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term>var</term>
+ <listitem>
+ <para>
+variable to load the content into
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>from</term>
+ <listitem>
+ <para>
+element to search for the element in. 'null' for root
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>path</term>
+ <listitem>
+ <para>
+path to search for the element, relative to $from
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry>Get the content item inside an element.</entry>
+ </row>
+ <row>
+ <entry>
+ <command>exp_printContent( $from $path
+ )</command>
+ </entry>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term>from</term>
+ <listitem>
+ <para>
+element to search for the element in. 'null' for root
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>path</term>
+ <listitem>
+ <para>
+path to search for the element, relative to $from
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry>Print the content item inside an element.</entry>
+ </row>
+ <row>
+ <entry>
+ <command>exp_standard()</command>
+ </entry>
+ <entry />
+ <entry>
+Setup the standard environment. Sets the following
+ variables: <variablelist>
+ <varlistentry>
+ <term>configManager</term>
+ <listitem>
+ <para>
+The com.jcorporate.expresso.core.misc.ConfigManager object
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>imagesDir</term>
+ <listitem>
+ <para>
+The images directory defined in the context
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>contextPath</term>
+ <listitem>
+ <para>
+The path of the current context
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>expressoDir</term>
+ <listitem>
+ <para>
+The location of the expresso directory as defined in the context
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>expressoContextPath</term>
+ <listitem>
+ <para>
+The full path of the expresso directory as defined in the context
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <command>errorMarkup()</command>
+ </entry>
+ <entry />
+ <entry>Print all errors, wrapped in html markup</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Using Velocity within Expresso</title>
+ <para>
+Using velocity with Expresso is simple: just define the .vm file as the
+forward of your action. For example, the following shows 2 examples of
+Login's promptSendPassword state. One uses jsp and the other uses Velocity:
+ </para>
+ <para>
+ <example>
+ <title>Login's promptSendPassword state using jsp</title>
+ <para>
+ <filename>struts-config.xml</filename>
+: </para>
+ <programlisting><![CDATA[<action path="/Login" type="com.jcorporate.expresso.services.controller.SimpleLoginController" name="default" scope="request" validate="false">
+ <forward name="promptLogin" path="/expresso/jsp/register/login.jsp"/>
+ <forward name="processLogin" path="/expresso/jsp/register/redirect.jsp"/>
+ <forward name="processLogout" path="/expresso/jsp/register/logout.jsp"/>
+ <forward name="promptChangePassword" path="/expresso/jsp/register/change.jsp"/>
+ <forward name="processChangePassword" path="/expresso/jsp/register/status.jsp"/>
+ <forward name="emailValidate" path="/expresso/jsp/register/status.jsp"/>
+ <forward name="promptSendPassword" path="/expresso/jsp/register/sendPassword.jsp"/>
+ <forward name="processSendPassword" path="/expresso/jsp/register/status.jsp"/>
+</action>]]></programlisting>
+ <para>
+ <filename>/expresso/jsp/register/sendPassword.jsp</filename>
+(simplified for illustrative purposes): </para>
+ <programlisting><![CDATA[<%@ page language="java" errorPage="../../error.jsp"%>
+<%@ taglib uri="/WEB-INF/tld/expresso.tld" prefix="expresso"%>
+<%@ taglib uri="/WEB-INF/tld/expresso-bean.tld" prefix="bean"%>
+<%@ taglib uri="/WEB-INF/tld/expresso-html.tld" prefix="html"%>
+<%@ taglib uri="/WEB-INF/tld/expresso-logic.tld" prefix="logic"%>
+<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="struts-bean"%>
+<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="struts-html"%>
+<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="struts-logic"%>
+
+<%@ page import="com.jcorporate.expresso.core.misc.StringUtil" %>
+<%@ page import="com.jcorporate.expresso.services.dbobj.Setup" %>
+<%@ page import="com.jcorporate.expresso.core.jsdkapi.GenericSession" %>
+<%@ page import="com.jcorporate.expresso.core.misc.ConfigManager" %>
+
+<%
+ String db = StringUtil.notNull(GenericSession.getAttributeString(request, "db"));
+ if (db.length() == 0) {
+ db = "default";
+ }
+ String contextPath = StringUtil.notNull(Setup.getValue(db, "ContextPath"));
+%>
+
+<html>
+<head>
+<expresso:stylesheet />
+<title><bean:message key="passwdResetSubject" /></title>
+
+</head>
+<body class="jc-default">
+
+<!-- top.inc -->
+<table border="0" width="100%" class="statuspage" cellpadding="3"
+ cellspacing="0">
+ <tr>
+ <td align="left" class="statuspage">
+ <td align="left" width="33%" class="statuspage">Logged in as: <expresso:UserName /></td>
+ <td align="center" width="33%" class="statuspage"> </td>
+ <td align="right" width=33% class="statuspage"><expresso:DBDescription /></td>
+ </tr>
+</table>
+<table border="0" width="100%" class="jc-datadivider" cellpadding="5"
+ cellspacing=0">
+ <tr class="jc-datadivider">
+ <td align="left" class="jc-datadivider"> Login and Registration</td>
+ </tr>
+</table>
+
+<!-- errorRow.inc -->
+<expresso:IfErrorExists>
+ <tr>
+ <td colspan=2>
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2>
+ <p><font class="jc-error-field"> <expresso:ErrorMessages /> </font></p>
+ </td>
+ </tr>
+</expresso:IfErrorExists>
+
+<form class="jc-default" action="<%=contextPath%>/Login.do" method=POST>
+
+<div align="center">
+<TABLE border="0" cellspacing="0" align="center">
+ <tr>
+ <td>
+ <P class="jc-emphasis"><bean:message key="passwdResetSubject" /></P>
+ </td>
+ <td align=right></td>
+ </tr>
+ <TR>
+ <TD nowrap><B>Email</B></TD>
+ <TD nowrap>
+ <html:text property="Email" />
+ </TD>
+ </TR>
+ <tr>
+ <td colspan=2>
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td ALIGN="center" colspan=2>
+ <expresso:TransitionTag name="processSendPassword" />
+ </td>
+ </tr>
+</TABLE>
+</div>
+</form>
+</body>
+</html>]]></programlisting>
+ </example>
+ </para>
+ <para />
+ <para>
+ <example>
+ <title>Login's promptSendPassword state using Velocity</title>
+ <para>
+ <filename>struts-config.xml</filename>
+
+(note the filename change in the path of the promptSendPassword forward):
+ </para>
+ <programlisting><![CDATA[<action path="/Login" type="com.jcorporate.expresso.services.controller.SimpleLoginController" name="default" scope="request" validate="false">
+ <forward name="promptLogin" path="/expresso/jsp/register/login.jsp"/>
+ <forward name="processLogin" path="/expresso/jsp/register/redirect.jsp"/>
+ <forward name="processLogout" path="/expresso/jsp/register/logout.jsp"/>
+ <forward name="promptChangePassword" path="/expresso/jsp/register/change.jsp"/>
+ <forward name="processChangePassword" path="/expresso/jsp/register/status.jsp"/>
+ <forward name="emailValidate" path="/expresso/jsp/register/status.jsp"/>
+ <forward name="promptSendPassword" path="/expresso/jsp/register/sendPassword.vm"/>
+ <forward name="processSendPassword" path="/expresso/jsp/register/status.jsp"/>
+</action>]]></programlisting>
+ <para>
+ <filename>/expresso/jsp/register/sendPassword.vm</filename>
+: </para>
+ <programlisting><![CDATA[<html>
+<head>
+#exp_standard()
+<link rel="stylesheet" type="text/css" href="$contextPath/expresso/style/default.css">
+<title>#exp_string( "passwdResetSubject" )</title>
+
+</head>
+<body class="jc-default">
+
+<!-- top.inc -->
+<table border="0" width="100%" class="statuspage" cellpadding="3"
+ cellspacing="0">
+ <tr>
+ <td align="left" class="statuspage">
+ <td align="left" width="33%" class="statuspage">Logged in as: $controllerResponse.getUser()</td>
+ <td align="center" width="33%" class="statuspage"> </td>
+ <td align="right" width=33% class="statuspage">$configManager.getContext($db).getDescription()</td>
+ </tr>
+</table>
+<table border="0" width="100%" class="jc-datadivider" cellpadding="5"
+ cellspacing=0">
+ <tr class="jc-datadivider">
+ <td align="left" class="jc-datadivider"> Login and Registration</td>
+ </tr>
+</table>
+
+<!-- errorRow.inc -->
+#if ($errors.exist() )
+ <tr>
+ <td colspan=2>
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2>
+ <p><font class="jc-error-field"> #errorMarkup() </font></p>
+ </td>
+ </tr>
+#end
+
+<form class="jc-default" action="$contextPath/Login.do" method=POST>
+
+<div align="center">
+<TABLE border="0" cellspacing="0" align="center">
+ <tr>
+ <td>
+ <P class="jc-emphasis">#exp_string( "passwdResetSubject" )</P>
+ </td>
+ <td align=right></td>
+ </tr>
+ <TR>
+ <TD nowrap><B>Email</B></TD>
+ <TD nowrap>
+ #exp_element($Email "Email")
+ <input type="text" name="Email" value="#exp_printContent($Email null)" />
+ </TD>
+ </TR>
+ <tr>
+ <td colspan=2>
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td ALIGN="center" colspan=2>
+ #exp_element( $processSendPassword "processSendPassword" )
+ <input type="submit" name="button_$processSendPassword.getName()" value="$processSendPassword.getLabel()">
+ $processSendPassword.getHTMLParamString()
+ </td>
+ </tr>
+</TABLE>
+</div>
+</form>
+</body>
+</html>]]></programlisting>
+ </example>
+ </para>
+ <para />
+ </sect2>
</sect1>
<sect1>
<title>How to shorten URLs in links</title>
@@ -695,24 +1232,18 @@
you do not want it. Here's the deal: In JSTL, the URL is generated in whole
by "fullUrl", and is "optimized" to remove the controller parameter if
it is unnecessary:
- <programlisting><![CDATA[
-<a href="<c:out value='${anAttrib.nestedMap[attribCustom].fullUrl}'/>"><small>View</small></a>
-]]></programlisting>
+ <programlisting><![CDATA[<a href="<c:out value='${anAttrib.nestedMap[attribCustom].fullUrl}'/>"><small>View</small></a>]]></programlisting>
However, with the old Expresso tag library, links are created partly from
'naked' text in the JSP and partly from the Expresso tag:
- <programlisting><![CDATA[
-<a href="<sri_expresso:Context/>AddNodeAction.do?<sri_expresso:TransitionParamsTag name="<%=AddNodeAction.VIEW_NODE%>"/>">blah</a></td>
-]]></programlisting>
+ <programlisting><![CDATA[<a href="<sri_expresso:Context/>AddNodeAction.do?<sri_expresso:TransitionParamsTag name="<%=AddNodeAction.VIEW_NODE%>"/>">blah</a></td>]]></programlisting>
note that we supplied the "file" part of the URL, "AddNodeAction.do" in
this example. I've added an option "omitControllerParam" to the TransitionParamsTag
that will omit the controller parameter. This is appropriate for most cases
where the transition is going to the same controller that we manually put
into the "file" section:
- <programlisting><![CDATA[
-<a href="<sri_expresso:Context/>/do/AddNodeAction?<sri_expresso:TransitionParamsTag omitControllerParam="true" name="<%=AddNodeAction.VIEW_NODE%>"/>">blah</a></td>
-]]></programlisting>
+ <programlisting><![CDATA[<a href="<sri_expresso:Context/>/do/AddNodeAction?<sri_expresso:TransitionParamsTag omitControllerParam="true" name="<%=AddNodeAction.VIEW_NODE%>"/>">blah</a></td>]]></programlisting>
So to reduce the size of URLs, you can go through all the TransitionParamsTag's
and add this option (after confirming that the destination controller is
@@ -758,9 +1289,7 @@
to the correct controller. Below is an example.
</para>
<para>
-
- <programlisting><![CDATA[
-<%-- form deliberately has no action attribute (assumes that this page
+ <programlisting><![CDATA[<%-- form deliberately has no action attribute (assumes that this page
was generated by an expresso controller) --%>
<form method="POST" name="form1" >
<%-- ... various inputs and outputs ... --%>
@@ -772,9 +1301,7 @@
>
<expresso_el:buttonparams
value="${controllerResponse.namedTransitions['mySubmitTrans']}"/>
-</form>
-
-]]></programlisting>
+</form>]]></programlisting>
</para>
<para>
@@ -782,9 +1309,7 @@
any controller you like. (Note: this feature was partially broken in v.5.5,
but fixed in cvs in whatever version comes after 5.5.1.) For example, you
can use a randomly-chosen expresso controller
- <programlisting><![CDATA[
- <form method="POST" name="form1" action="<c:url value='/Download.do' />" >
-]]></programlisting>
+ <programlisting><![CDATA[<form method="POST" name="form1" action="<c:url value='/Download.do' />" >]]></programlisting>
</para>
</sect1>
<sect1>
@@ -811,7 +1336,6 @@
</itemizedlist>
</para>
<para>
-
<note>
<para id='donate_jsp'>
Was this EDG documentation helpful? Do you wish to express your appreciation
More information about the cvs
mailing list