Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java
Expertise: Advanced
Mar 6, 2003



Application Security Testing: An Integral Part of DevOps

Set Attributes in a Servlet Request

Usually, you set attributes in a session and the attributes are available through out the session. If you want to limit the scope of an attribute to just a request, you can set the attributes on a request object. This is how:

attributeName - This is a string , the names starting with java., javax.,
sun., com.sun. are reserved names.
attributeValue - This is any object.

You can forward this request to other servlets or jsps using requestDispatcher and make the attributes available there.

You can get the attributes in the target servlet/jsp using:

Thus, you can increase the functionality of your request object not just by limiting it to get parameters, which is a normal practice. This also helps in reducing the load on session.
Ram Dhan
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