setAttribute/getAttribute

Hi

I am having problem with setAttribute and getAttribute.

in my first servlet i have

String[] test = {"test1", "test2", "test3"};

request.setAttribute("supplyName", test);

<FORM>

-

-

</FORM>

from my second servlet i have

String[] abc = (String[])request.getAttribute("supplyName");

problem is my abc is null.

Anyone has solution to problem, please let me know.

AP

[463 byte] By [ap3000] at [2007-9-27 21:45:21]
# 1
If you instead print out, on secod servlet page:[code]String[] abc = request.getAttributeValues("supplyName");[/code}Does it work then?Andreas
AGustafsson at 2007-7-7 3:44:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Setting a request attribute only lasts per request. Once you complete a request then any attributes set are gone. ie when you access a servlet your making a new request.

If you are forwarding or including then its a different story as the request is passed on to the included servlet.

Cheers,

Anthony

[tone] at 2007-7-7 3:44:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Are you sure the second servlet is called as part of the same request? i.e. does servlet1 forward to servlet2?
GrayMan at 2007-7-7 3:44:19 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...