JSP CUSTOM TAG LIBRARIES


Setting default JSP attribute values
JSP tags are designed to enable you to specify attributes for each tag as you add each to the page. However, you might want to provide default values for any tag attributes that will be constant for the life of an application, session, request, or page to prevent yourself from having to supply them each time you reference the tag.

This section defines:


Default Domino tag attributes

The following table displays the variables you can set as defaults for the corresponding attributes of a Domino JSP tag. These variables create either of the following attributes:


If the attribute is explicitly specified, it will override these default variable values:
AttributeVariable NameDescriptionContained by
bundlemsgbundleName of the message bundle to use to look up internationalized messages. Default is:

messages

hosthostName of the Common Object Request Broker Architecture (CORBA) server that the tags will communicate with instead of using the local Notes Object Interface (NOI) calls. If no session tag is used, all the tags will check for the existence of this attribute to initialize the NOI session. All "Local" databases are considered local to the CORBA server.db, form, ftsearch, session, view
dbnamedbnameName of the database being accessed.db, form, ftsearch, view
dbserverdbserverName of a remote Domino server that hosts the database being accessed. This attribute is not often used. It should be specified if the data content for an application is stored in a different database from the database storing the design data for the application. Default is:

Local

db, form, ftsearch, view
localelocaleName of the locale to use to look up internationalized messages or to perform output formatting. Use this format:

<languageCode>_<countryCode>

By default, the locale is derived by the container from the browser's Acceptlang string. See Locale codes for language and country code information.

onfailureonfailureIndicates how a failure should be handled. Must be either: inline or exception.All tags
passwordpasswordPassword associated with the specified user ID.

Note If you supply the password this way - using a default page parameter, it will be exposed in the URL string. You can prevent this by using container-managed access.

db , form, ftsearch, session, view
responsetoresponsetoDomino Unique ID of the parent document that a response document responds to.form
timezonetimezoneTime zone to use to format and parse dates. Defaults to the time zone of the server (not the browser).All tags
unidunidDomino Unique ID for the context document.form
useruserUser ID used to log into the session. Default is Anonymous. db , form, ftsearch, session tag, view
viewnameviewnameName of the view to display or to use as the view context for the form or query.form, view

Supplying attribute values

The JSP tags always look for these attribute values to be supplied as:

1. an explicitly supplied attribute:


2. an initialization parameter value stored in the servlet context*, using either:
3. an attribute value stored in the page context*, using either: 4. a parameter in a requesting url query string:
5. a default value defined in the code that implements the tags
*See the Servlet 2.2 specification at http://java.sun.com/products/servlet/download.html for more information about servlet contexts and the JSP 1.1 specification at http://java.sun.com/products/jsp/download.html for more information about JSP page contexts.

Standard JSP variables

The following table contains the standard JSP variables that you can use in your pages:

Data TypeVariable
HttpServletRequestrequest
HttpServletResponseresponse
PageContextpageContext
HttpSessionsession
ServletContextapplication
ServletConfigconfig
JspWriterout

Search order for default values

The following table demonstrates the hierarchy the JSP tags use to search the environment for the values of the default tag attributes if one of them is not supplied:

ScopeRetrieval MethodVariable Name(<varname>)
Tagattribute value
ServletContextServletContext.getInitParameter()lotus.domino.preset.<varname>
APPLICATION_SCOPEPageContext.getAttribute()lotus.domino.preset.<varname>
SESSION_SCOPEPageContext.getAttribute()lotus.domino.preset.<varname>
REQUEST_SCOPEPageContext.getAttribute()lotus.domino.preset.<varname>
PAGE_SCOPEPageContext.getAttribute()lotus.domino.preset.<varname>
Query stringHTTPServletRequest.getParameter()<varname>
PAGE_SCOPEPageContext.getAttribute()lotus.domino.default.<varname>
REQUEST_SCOPEPageContext.getAttribute()lotus.domino.default.<varname>
SESSION_SCOPEPageContext.getAttribute()lotus.domino.default.<varname>
APPLICATION_SCOPEPageContext.getAttribute()lotus.domino.default.<varname>
ServletContextServletContext.getInitParameter()lotus.domino.default.<varname>
If the attribute value is still not found, an exception is thrown.

See Also