Guidelines: Designing JavaServer
Pages (JSPs)
Topics
Introduction
This guideline focuses on designing of JSPs. Additional guidance on JSPs,
such as how to identify and model them, is provided by Guidelines:
JSPs.
Session State
Session state data managed or used by a JSP should be documented in the design
of the JSP. See Guidelines: Designing
State for J2EE Applications for guidance on session state.
Servlet Context
Any interactions with the Servlet context should be documented in the design
of the JSP. Servlet context is data global to the application, and should be
managed carefully. See Guidelines:
Designing State for J2EE Applications for additional discussion of this
mechanism.
Granularity and Responsibility
You should minimize the amount of Java code in a JSP, to improve maintainability
and reusability, and to reduce complexity so that presentation designers can
deal with page design without having to deal with Java code. Do this by
using JavaBeans and custom tag libraries.
JSP provides specific tags for invoking JavaBeans. Custom tags provide a simpler
tag-with-attributes interface for accessing JavaBeans.
Common control logic should be moved into servlets, and business logic should
be moved into JavaBeans (or into EJBs).
Consider using JavaScript to perform simple validation of input data at the
client, to avoid the network overhead of passing a request back to the server.
|