Hi Rusty,

> My problem is that when Stripes is calling the FacilityAdminDto's
> setPlatforms, the Platform object it has created has its name set to the
> stringified id that's in the jsp, the value= part of the checkbox.  As
> far as I can tell it's because it's calling a Platform constructor that
> takes a string arg (it has several constructors)
> 
>     public Platform(final String _name) {
>         this(_name, 0);
> 
>         this.log.debug("creating with name: {}", _name);
>     }
> 
>     public Platform(final String _name, final int _ordinal) {
>         this.name = _name;
>         this.ordinal = Short.valueOf((short) _ordinal);
>     }
> 
> In my logs I can see the debug log statement; I never call that
> constructor.  In my logs the toString for FacilityAdminDto also shows
> that the Platform Set has Platforms with their names set to the id string
> that was in the jsp.
> 
> If I comment out that constructor (and fix my test code to use the one
> that specifies an ordinal), then it still tries to call it but gets an
> exception
> 
> [rusty-sandbox/4.338085272165943020].<stdout>: 2009-11-29 03:44:35.940
> UTC,  WARN: [Runtime Network Thread]
> net.sourceforge.stripes.util.Log.warn.94: Looks like type converter null
> threw an exception.
> java.lang.NoSuchMethodException:
>
> I'm lost and confused.

I think the problem is that you do not have a type converter for
Platform.
When you map checkboxes to a Collection<T>, Stripes tries to add the
values
to the collection, converting each value to T.

Since there is no TC for Platform, the last resort for Stripes is to try
a (String) constructor, which it found and called (much to your
surprise;)
and it throws an exception if there is no such constructor (the
exception
you received when you removed the String constructor).

A simple TC that converts the String id to a Platform will solve the
problem, or you can use indexed properties with a List<Platform>.

Hope that helps.

Cheers,
Freddy
http://www.stripesbook.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to