| Author |
getAttribute and getParameter
|
Maureen
Greenhorn
Joined: Jun 17, 2005
Posts: 1
|
|
What is the difference of getAttribute and getParameter? and how to use them? Thanks
|
 |
Mishra Anshu
Ranch Hand
Joined: Sep 16, 2003
Posts: 224
|
|
Please refer to the documentation for detailed differences. One of the differences is , in request.getParameter("var") method, you get the parameter value of the variable "var" which was sent through the HTML page and return a String value. But in case of the request.getAttribute(Object o) method, you get the attribute added for Object o as the return value. These value are not sent through some of the component on the HTML form rather in the jsp page which produced that particular HTML page must code it like -- request.setAttribute(name, value). Hope it helps a bit.
|
"Ignorance is bliss"
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
|
As Mishra said, read the docs. There is no other better substitute.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
The said documentation: http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.html
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56197
|
|
"Maureen", There aren't may rules that have been put into place here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it. In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Thanks! bear Forum Bartender
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: getAttribute and getParameter
|
|
|