File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Object to String array" Watch "Object to String array" New topic
Author

Object to String array

scott dawson
Greenhorn

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?

Thanks
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
 
Similar Threads
How is priority determined?-Collection Doubt
An odd array phenomenon
Arrays in Javascript
Widening Reference Conversation
problem using generics jdk1.5 in jsp