Re: convert string to object?
Re: convert string to object?
- Subject: Re: convert string to object?
- From: arturo <email@hidden>
- Date: Mon, 01 Dec 2003 13:06:28 -0500
You need to look at how to use formatters. The base class is
java.text.Format.
But in addition to this you're not using the dropdown list in the most
optimal way.
You should be binding the list variable to an NSArray of your objects
(Department
in this case?). You should be binding the display variable to something
that turns
the Department object into a string (toString would work). And you need to
bind
the selection variable to an instance variable of selectedDepartment. Then
the list
will automatically set selectedDepartment to selected object from the array.
If you follow the above approach then you won't need formatters.
----- Original Message -----
From: "Janice M. Cheung" <email@hidden>
Cc: <email@hidden>; <email@hidden>
Sent: Monday, December 01, 2003 12:48 PM
Subject: convert string to object?
>
> Hi there,
>
> Is there a simple function to convert a string to an object?
>
> I am attempting to use something like this for outputting PDFs in
> WebObjects, so that
> any selections from a dropdown menu (String type) will create those
> selected Objects
> in a report:
>
> Here is one of my functions to change selected String values into
> objects of type Department:
>
> public java.lang.String toObject(){
> String currentDept;
> currentDept = toObject();
> return currentDept;
> }
>
> I've also tried to set string types in Search.java and set them in
> Session.java to type Department, to
> no avail:
>
> --- Search.java
> String m_currentDept;
> s.setCurrentDepartment(m_currentDept);
>
> (basically I want "currentDept" to be converted to type Department)
>
> --- Session.java
> public Department currentDepartment(String currentDept){
> return currentDepartment;
> }
>
> public Department getCurrentDepartment(String currentDept){
> return currentDepartment;
> }
>
> public void setCurrentDepartment(Department newCurrentDepartment){
> currentDepartment=newCurrentDepartment;
> }
>
> These string values are retrieved as qualifiers from the database...
> any advice or guidance
> would be greatly appreciated!!
>
> Thanks very much!
>
> Happy Happy Holidays!
>
> Janice
>
> _______________________________________________
> WebObjects-dev mailing list
> email@hidden
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.