Integrating Custom Database Actions

The JSTL database access actions look for the default values set by the configuration settings described in Tables Table 23-5 and Table 23-6.

Table 23-5. Data-source configuration setting

Variable name:

javax.servlet.jsp.jstl.sql.dataSource

Java constant:

Config.SQL_DATA_SOURCE

Java type:

String or javax.sql.DataSource

Set by:

<sql:setDataSource>, context parameter or custom code

Used by:

<sql:query>, <sql:update>, and <sql:transaction>

Table 23-6. Maximum rows configuration setting

Variable name:

javax.servlet.jsp.jstl.sql.maxRows

Java constant:

Config.SQL_MAX_ROWS

Java type:

String or Integer

Set by:

Context parameter or custom code

Used by:

<sql:query>

The data-source setting can be set as a String in this format, in which optional parts are shown between brackets:

url [, [driver] [, [user] [, [password]]]

Commas separate the parts, so if the value for any part contains a comma, it must be escaped with a backslash. This type of value creates a simple DataSource without any pooling capabilities, and is intended only for prototype and low-end applications, as described in Chapter 12. It can also be set to a JNDI path for a DataSource made available by the container or to a DataSource created by custom code, such as a servlet or listener. These options are described in detail in Chapter 24.

The maximum rows setting can be set as a String value for a context parameter or as an Integer by custom code. It can be used to prevent ...

Get JavaServer Pages, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.