Chapter 11. Advanced servlet
ITSS Java Programming
Dr. NGUYEN Hong Quang, FIT-HUT
HttpServletRequest interface
Outline
provide request information for HTTP servlets.
The servlet container creates an
HttpServletRequest object and passes it as an
argument to the servlet's service methods
(doGet, doPost, etc).
Request information
Client request information including :
parameter name and values,
and an input stream
Attributes : custom information about a request
HttpServletRequest Interface
Operating with attributes
Extends the ServletRequest interface
Returns the value of attribute :
public Object getAttribute(String name)
Stores an attribute in this request :
public void setAttribute(String name, Object o)
HttpServletRequest Interface
Forwarding : cooperation between
several Servlets
…
Client
Web
browser
Display
reading page
URL address
Internet
Application server
Request
Response
Link in a
Web page
Servlet 1
Servlet 2
Servlet N
• Require
parameters
•
Proccessing
data
• Connecting
to database
• …