Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Using Parameters from an XMAP in ServerPages

You can send parameters from an XMAP to a ServerPage.

1. In the XMAP, use the following format:
<map:generate type="serverpages" src="date.xsp">
<map:parameter name="date" value="{date-i18n:currentDate}"/>
</map:generate>


All of the standard and pipeline variables are available.

2. Inside the top-level result element of an XSP, there are three options:
a. Use the standard "parameters" object in Java.
String myvar1 = parameters.getParameter("parameterName", "defaultValue");
b. Mix Java with special XSP elements.
String myvar2 = <xsp-request:get-parameter name="parameterName" default="defaultValue"/>;

I have not found any differences in the results of these options, so choose one based on your (or your company's) style. I prefer the former because it does not mix tags and Java. I believe the latter is translated to the former during compilation, so there may be a very slight performance increase.

Note that the following lines have very different results:
parameters.getParameter(XMAPParameterName);
request.getParameter(QuerystringParameterOrPostField);
(depends on the Form METHOD.)

WARNING: This code must be inside the top-level result element. You will receive weird errors if it is placed before the top-level result element begins.


<< WarningVariables >>

Contact Solprovider
Paul Ercolino