wood burning stoves
The moose likes Java in General and the fly likes Object to String array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Object to String array" Watch "Object to String array" New topic

Object to String array

scott dawson

Joined: Jun 30, 2003
Posts: 18
I'm not sure if this should be in this forum or the JSP or Servlet forum...but here goes.

I want to convert a type object to a String array.
We're adding a String array to the request object in the servlet code, but in the JSP code when I get the attribute (which is working), it comes back as a type Object. But where do I go from there?

Darin Niard
Ranch Hand

Joined: Jun 08, 2004
Posts: 118
Did you try casting it to String[]?
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
I guess you're using the getAttribute() method from the request object. This method returns an object. As Darin suggested, cast it to the String[].

SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
I agree. Here's the link: http://aspose.com/file-tools
subject: Object to String array
It's not a secret anymore!