Java Reference
In-Depth Information
chosen servlet is responsible for fulfilling the request and ultimately crafting a
response that is returned to the client.
A filter , on the other hand, is a Java-based web component that can transform
the content of a servlet request, response, or header information. It isn't respon-
sible for crafting a response to a request but rather is intended to modify requests
sent to, and responses sent from, servlets. Filters are often used to perform
authentication, logging, encryption, tokenizing, event notification, and other
data-manipulative or data-reactive responsibilities.
Because servlets are Java objects that implement the Servlet interface, and fil-
ters are Java objects that implement the Filter interface, you can work on both
types of files using the full editing capabilities of the IDEA editor. All the features
discussed that apply to editing plain Java objects also apply to editing servlets
and filters. But because servlets and filters exist within the context of a web appli-
cation, running and testing them is handled a bit differently. We'll discuss that
specifically later in this chapter in section 11.4.
11.1.6
Working with JavaServer Pages
JavaServer Pages is a technology for building applications that use or generate
dynamic content, typically HTML , XML , or one of their variants. Much like serv-
lets, JavaServer Pages ( JSP s) are responsible for handling a request and crafting an
appropriate response; in fact, the JSP technology is built directly atop Java Servlet
technology and gives web application developers a more convenient framework.
JSP s use a template framework. A JSP page that is intended to return an HTML
page as a response to a client looks much like an HTML page with some dynamic
content added through the use of JSP tags. The web application server is respon-
sible for transforming the JSP into a servlet that produces the exact output
defined by the JSP and then using that servlet to service incoming requests.
IDEA identifies JSP files by their file extension and enables special JSP editing
features when you open a file with the appropriate extension. By default, the file
extension .jsp and the extensions for JSP fragments (.jsf and .jspf) are recognized.
You can make adjustments to this list—such as adding a new extension that rep-
resents a JSP file—through the File Types settings window. As with creating any
new file, you need to provide the proper extension or IDEA will be unable to open
files in the appropriate editor.
Using JSP syntax highlighting
IDEA supports syntax highlighting for JSP s. You can map different colors and styles
to the types of JSP entities, including scriptlets, directives, actions, and comments.
 
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search