Uses of JSP Constructs
Scripting elements calling
Simple
servlet code directly
Application
Scripting elements calling
servlet code indirectly (by
means of utility classes)
Beans
Custom tags
Complex
Servlet/JSP combo
Application
(MVC architecture)
115
JSP
www.corewebprogramming.com
Review: Calling Java Code
Directly: JSP Scripting Elements
JSP Expressions
Format:
<%= expression %>
Evaluated and inserted into the servlet's output.
JSP Scriptlets
Format:
<% code %>
Inserted verbatim into the _jspService method
JSP Declarations
Format:
<%! code %>
Inserted verbatim into the body of the servlet class
Predefined variables
request, response, out, session, application
Limit the Java code in page
Use helper classes, beans, custom tags, servlet/JSP combo
116
JSP
www.corewebprogramming.com
58