| ||
![]() |
Standard Variables in ServerPages | |
|
The "request" object is available inside the top-level results element. Most other objects can be retrieved from the request object. See Request for the complete list of functions. The most common example is:
Session session = request.getSession(true);
The request object makes it possible to retrieve form fields without knowing their names: Enumeration parameterNames = request.getParameterNames();
Whether this returns Querystring parameters or Form Fields depends on whether there is a METHOD="POST". There are also some tag versions of the functions. These return Strings: <input:get-attribute module="access-control" name="ip-address"/> <input:get-attribute module="access-control" name="role-ids" as="string"/> <input:get-attribute module="access-control" name="user-email" as="string"/> <input:get-attribute module="access-control" name="user-id"/> <input:get-attribute module="access-control" name="user-name"/> <input:get-attribute module="date" name="currentDate"/> <input:get-attribute module="dublincore" name="created"/> <input:get-attribute module="dublincore" name="creator"/> <input:get-attribute module="dublincore" name="description"/> <input:get-attribute module="dublincore" name="publisher"/> <input:get-attribute module="dublincore" name="rights"/> <input:get-attribute module="dublincore" name="subject"/> <input:get-attribute module="dublincore" name="title"/> <input:get-attribute module="page-envelope" name="area" as="string"/> <input:get-attribute module="page-envelope" name="area"/> <input:get-attribute module="page-envelope" name="context-prefix" as="string"/> <input:get-attribute module="page-envelope" name="document-dc-description" as="object"/> <input:get-attribute module="page-envelope" name="document-dc-title" as="object"/> <input:get-attribute module="page-envelope" name="document-id"/> <input:get-attribute module="page-envelope" name="document-language"/> <input:get-attribute module="page-envelope" name="document-lastmodified" as="object"/> <input:get-attribute module="page-envelope" name="document-type" as="object"/> <input:get-attribute module="page-envelope" name="publication-id" as="string"/> <input:get-attribute module="request" name="requestURI" as="string"/> (long version demonstrating any request variable without knowing the specific tag for using the "xsp-request" element.) <input:get-attribute module="request-param" name="querystringParameterName" as="string"/> (This returns a querystring parameter, not an XMAP parameter.) <input:get-attribute module="sitetree" name="document-id" as="string"/> <input:get-attribute module="workflow" name="state" as="string"/> <input:get-attribute module="workflow" name="variable.is_live" as="string"/> <xsp-request:get-uri/> <xsp-request:get-context-path/> <xsp-session:get-attribute name="org.apache.lenya.cms.cocoon.acting.Authenticator.id"/> (really complicated method of getting publication-id) <xsp-session:get-attribute name="org.apache.lenya.cms.info.firstarea"/> <xsp-session:get-attribute name="org.apache.lenya.cms.info.firstdocid"/> Any variable from the Variables pages should be accessible with the input:get-attribute element. These return Objects: org.apache.lenya.ac.GroupManager groupManager = (GroupManager) <input:get-attribute module="access-control" name="group-manager" as="object"/>; org.apache.lenya.ac.IPRangeManager manager = (IPRangeManager) <input:get-attribute module="access-control" name="iprange-manager" as="object"/>; org.apache.lenya.ac.RoleManager roleManager = (RoleManager) <input:get-attribute module="access-control" name="role-manager" as="object"/>; org.apache.lenya.ac.UserManager userManager = (UserManager) <input:get-attribute module="access-control" name="user-manager" as="object"/>; org.apache.lenya.cms.publication.Document doc = (Document) <input:get-attribute module="page-envelope" as="object" name="document"/>; org.apache.lenya.cms.publication.Publication pub = (Publication) <input:get-attribute module="page-envelope" as="object" name="publication"/>; org.apache.lenya.cms.SiteTreeNode authoringNode = (SiteTreeNode) <input:get-attribute module="sitetree" as="object" name="authoring-node"/>; org.apache.lenya.cms.SiteTreeNode liveNode = (SiteTreeNode) <input:get-attribute module="sitetree" as="object" name="live-node"/>; 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.
|