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 http://www.oreilly.com/catalog/jserverpages/ or from the web site dedicated to this book at http://www.TheJSPBook.com.
Generic Custom Actions
The following are
generic custom actions defined in
the ora
custom tag library.
<ora:addCookie>
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 |
Description |
---|---|---|---|
maxAge |
String |
Yes |
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. |
name |
String |
Yes |
Mandatory. The cookie name. |
value |
String |
Yes |
Mandatory. The cookie value. |
Example:
<%-- 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 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.