Appendix C. Book Example Custom Actions and Classes Reference

This appendix contains reference material for all custom actions, utility classes, and beans described in this book that can be used as-is in other applications.

Example code in this book that is not intended to be reused directly is not included in this appendix. All source code for the book can, however, be downloaded either from the O’Reilly web site at or from the web site dedicated to this book at

Generic Custom Actions

The following are generic custom actions defined in the ora custom tag library.


The <ora:addCookie> action sets response headers for creating or deleting a cookie. It must be used before the response is committed, for instance before a <jsp:include> action. The attributes supported by this action are described in Table 3.1.

Table C-1. <ora:addCookie> Attributes

Attribute Name

Java Type

Request-TimeValue Accepted




Optional. The number of seconds before the cookie expires. Default is -1, meaning that the cookie expires when the browser is closed. Use to delete the cookie from the browser.



Mandatory. The cookie name.



Mandatory. The cookie value.


<%-- Add a cookie named "userName", using the value from a request parameter with the same name, that expires in 30 days. --%> <ora:addCookie name="userName" value='<%= request.getParameter("userName") ...

Get Java Server Pages now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.