Re: request.setAttribute() fails to set attribute - help
- From: Lothar Kimmeringer <news200601@xxxxxxxxxxxxxx>
- Date: Sat, 28 Jan 2006 23:19:17 +0100
phillip.s.powell@xxxxxxxxx wrote:
> request.setAttribute("message", (Object)URLEncoder.encode(message,
> "UTF-8"));
> request.setAttribute("nickname", (Object)URLEncoder.encode(cookie,
> "UTF-8"));
> out.println("message = " + request.getParameter("message") + " and
> nickname = " + request.getParameter("nickname"));
[...]
> When viewing the contents via out and you click the "Send" button, you
> get this:
>
> [quote]message = blah blah blah and nickname = null[/quote]
>
> When viewing the contents via out and you click the "Quit" button, you
> get this:
>
> [quote]message = and nickname = null[/quote]
>
> How is this possible when I'm setting request.setAttribute()
> beforehand? Is there something else I need to do to alter or add values
> to HttpServletRequest request before submitting it as parameter to
> MessageProcessor?
I'm not sure if I understand your problem, but if you set something
with setAttribute, shouldn't you use getAttribute for getting
the attribute again? getParameter returns the value for a given
querystring-entry, e.g.
http://somehost.invalid/path/servlet?key=value
key=value is the querystring and request.getParameter("key")
should return "value". Maybe there is a setParameter-method
(I dont' have the Servlet-API at hand right now) you can use
and solve your problem.
Regards, Lothar
--
Lothar Kimmeringer E-Mail: spamfang@xxxxxxxxxxxxxx
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)
Always remember: The answer is forty-two, there can only be wrong
questions!
.
- Follow-Ups:
- Re: request.setAttribute() fails to set attribute - help
- From: phillip.s.powell@xxxxxxxxx
- Re: request.setAttribute() fails to set attribute - help
- References:
- request.setAttribute() fails to set attribute - help
- From: phillip.s.powell@xxxxxxxxx
- request.setAttribute() fails to set attribute - help
- Prev by Date: request.setAttribute() fails to set attribute - help
- Next by Date: Re: request.setAttribute() fails to set attribute - help
- Previous by thread: request.setAttribute() fails to set attribute - help
- Next by thread: Re: request.setAttribute() fails to set attribute - help
- Index(es):