Name

<sql:param>

Synopsis

The <sql:param> action is used as a nested action for <sql:query> and <sql:update> to supply a value for a value placeholder. If a null value is provided, the value is set to SQL NULL for the placeholder. To ensure portability between different database engines, the value type must be a supported type for the target column, for instance a numeric value for an INT or FLOAT column, and a String value for a CHAR or VARCHAR column. See <sql:dateParam> for setting values for DATE, TIME, and TIMESTAMP columns.

Syntax 1: Without a body

<sql:param value="parameterValue" />

Syntax 2: With a body

<sql:param>
  parameterValue
</sql:param>

Attributes

Attribute name

Java type

Dynamic value accepted

Description

value
Object

Yes

The parameter value

Example

<sql:update>
  DELETE * FROM Employee WHERE Id = ?
  <sql:param value="${empId}" />
</sql:update>

Get JavaServer Pages, Second 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.