On Wed, 26 Apr 2000, Yogesh More wrote:

> Thanks Hans,
> I was compiling the code using a jsdk.jar , which said that all my
> getParameter  calls are deprecated !! Someone replied saying use
> getAttribute() .. method to be used. I substituted all these methods by
> getAttribute, resulting in no deprecations,  hence *assumed* the
> deprecation.
>
> Sorry for the false information.
>
> I also read through the differences between the two, and you have explained
> it perfectly.

What Hans says is correct.  You must be using an "inbetween" version
of the JSDK, because at one point getParameter() *was* indeed
deprecated, but then due to popular outcry , it was un-deprecated (a
first in Java history? :-).  The reason it was deprecated was because
a parameter can have multiple values, so they wanted people to use
getParameterValues() and take the first value.  Then when
getParameter() was restored it was defined to return that first value.
(At least, that's the way I remember it.)


> > -----Original Message-----
> > From: Hans Bergsten [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 26, 2000 12:15 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: Is getParameter(String key) deprecated?
> >
> > Yogesh More wrote:
> > >
> > > yep Farooq is right, it's 2.2.
> > > I got hold of both the 2.2 API and the docs ...
> > >
> > > The answer being  -
> > > the method is deprecated and
> > > the method substituting it is
> > > Object getAttribute(java.lang.String key)
> >
> > Actually, that's not quite true.
> >
> > Yes, the latest version of the Servlet API is 2.2. This answer is easy to
> > find
> > by visiting Sun's Servlet API pages, at
> >
> >   <http://java.sun.com/products/servlets/>
> >
> > Reading the information available there, plus your servlet container
> > vendors
> > documentation, answers a lot of the questions posted on this list.
> >
> > If you read the Servlet 2.2 API specification, you will also see that
> > the getParameter() method is *not* deprecated. This method, and the
> > related
> > getParameterNames() and getParameterValues() methods, are used to read
> > HTTP
> > request parameters. The getAttribute() method, and the other attribute
> > methods,
> > are used to read and set request *attributes*. A parameter is typically
> > set by
> > the client (e.g. the browser) and must be a string. An attribute is never
> > set
> > by the client, but it can be set by a servlet before forwarding to or
> > including
> > another servlet or JSP page. In fact, request attributes corresponds to
> > the
> > request scope in JSP pages, so it's very commonly used to pass beans from
> > a servlet to a JSP page.
> >
> > Hans
> > --
> > Hans Bergsten           [EMAIL PROTECTED]
> > Gefion Software         http://www.gefionsoftware.com
> >
>

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to