wood burning stoves 2.0*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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
 
jQuery in Action, 2nd edition
 
subject: Object to String array