| Author |
getAttribute()
|
VENKATESH NADAGOUDA
Greenhorn
Joined: Jan 29, 2003
Posts: 7
|
|
|
can we use getAttribute() to read the contents of querystring.If not why
|
 |
Mike Curwen
Ranch Hand
Joined: Feb 20, 2001
Posts: 3695
|
|
Yes, that's the exact right method to use. If you are trying and having trouble, post some of your code. My first question would be: do you have a file upload form element in the form? If so, this will not play nicely with getAttribute()
|
 |
Dominic Paquette
Ranch Hand
Joined: Dec 13, 2002
Posts: 64
|
|
Hi, Did you try HttpServletResponse.getQueryString() ?
|
 |
Bosun Bello
Ranch Hand
Joined: Nov 06, 2000
Posts: 1506
|
|
|
getQueryString() is actually a method of HttpServletRequest.
|
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
|
 |
VENKATESH NADAGOUDA
Greenhorn
Joined: Jan 29, 2003
Posts: 7
|
|
Dear All Firstly thank u, now which is more advantageous getAttribute() or getParameter()
|
 |
Mike Curwen
Ranch Hand
Joined: Feb 20, 2001
Posts: 3695
|
|
You know what? I'm totally out to lunch. I must have had a brain freeze. If you are submitting a form, or click on a link that contains name/value pairs, then the way to get these items is with getParameter() So if the URL to the servlet looks like: http://www.localhost:8080/app/servlet1?name=foo&name2=bar then here is how you access the name and name2 parameters... When you programatically *add* things to a request or a session, the way to get these 'extra' things is within the attribute space. setAttribute() and getAttribute() are used for this purpose. Only those things that you "set" with setAttribute can be "gotten" with getAttribute. Sorry for that confusion!
|
 |
VENKATESH NADAGOUDA
Greenhorn
Joined: Jan 29, 2003
Posts: 7
|
|
Hi, Thanks Mike.
|
 |
 |
|
|
subject: getAttribute()
|
|
|