Am 28.12.2005 19:23 Uhr schrieb "Chuck Hill" unter
<[EMAIL PROTECTED]>:

Hi Chuck,

thanks for this perfect support.
Practical WO has been a little incomplete on this to get it working :-)

> I think  you are slightly mistaken.  The stack trace indicates that
> the problem happens during the takeValues phase, which occurs before
> invokeAction and the code tied to the Submit button.
I'll practice reading stack traces, i promise

> 
>> java.lang.IllegalArgumentException: While trying to invoke the set
>> method
>> "public void CSampleTable.setAvalue(MyType)" on an object of type
>> CSampleTable we received an argument of type java.lang.String. This
>> often
>> happens if you forget to use a formatter.
I was told about the formatter...

>
...

>> What am i missing?
>> 
> There are a few things you can do.  One is to follow EOF's suggestion
> and add a formatter that can format (convert between) MyType and
> String.  Given a String s, it will return new MyType(s).  Given a
> MyType t, it will return t.getValue().
...
> 
> I'd prefer a formatter: it keeps the code all in one place and is
> easy to reuse.  I'd avoid adding code to CSampleTable as you would
> have to do this in every object that used MyType.
I followed your recommendations regarding the implementation of the MyType
class (immutable etc.).
Further i implemented a formatter "MyTypeFormatter" which i use for data
exchange in my component.
Works like a charme!!!

One question remains:

I allocate the formatter as a public final member in my application at the
moment. Is it a reasonable place or should i allocate it in session or
component context?

I would say, session is best for speed, resources and safety, do you agree?

Thanks

Wolfram

P.S. In a short while i will publish my "BaseWOApp" with several interesting
solutions (MyType EO data type, timertask for property update [from
PropDemo.zip, www.bugs-and-errors.de], page member pushing and popping for
correct forward and backward navigation, standard error handling pages...)
That's something for beginners :-)


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to