Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java Servlets
Expertise: Beginner
Oct 15, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Servlet Attributes and Parameters

When a request message is processed through the HttpServlet doGet method, who sets the parameters and attributes for the HttpServletRequest argument? And what is the difference between an attribute and a parameter?

Client requests are passed on to a servlet through the Web server's servlet engine. The servlet engine packages the request into a ServletRequest object, through which request attributes and parameters can be extracted.

The HttpServlet class examines the request and repackages it as an HttpServletRequest before dispatching it to one of its "do" methods, such as doGet. Attributes provide a means for the Web server to give a servlet extra information about a request. They do not represent data that was sent directly from the client.

Parameters are akin to function arguments. They are name value pairs transmitted by the client and interpreted by the servlet.

For example, the values submitted through an HTML form would be passed as parameters that could be accessed through the HttpServletRequest argument to doGet.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date