getAttribute is used get object available in request, session and servletContext. getAttribute returns an Object.
Originally posted by vidya vani:
Iwas bit confused about the scope of attributes while using them.what is the difference between getParameter() and getAttrbibute() in servlet,jsp.
use getParameter() when the request /form is submitted to the server where as getAttribute() can be used at page,sesion and application level
-if a variable is set at request level using setAttribute that can be accessed by getAttribute only in the immediate submitted page
-if a variable is set at session level using setAttribute that can be accessed by getAttribute throught the session availability
-if a variable is set at context level using setAttribute that can be accessed by getAttribute through out the application by all the users
Originally posted by siva prasad java:
get parameter is used to get the value for one jsp page to other.
This isn't entirely accurate either.
The request.getParameter method is used to retrieve form and query string parameters. In other words, parameters are used to pass values from the browser to the server.
By using hidden input fields, you can use parameters to pass values from one JSP or servlet to another but the primary purpose is to gather user input from the client.