Great that you're moving again.

I'd look for a better alternative that coercing null to 0.  That
causes a lot of grief in other areas. There's now more explicit
handling of nulls and blanks from the user via the nulls parameter on
TextField & friends.

On Jan 29, 2008 11:12 AM, Joel Wiegman <[EMAIL PROTECTED]> wrote:
> Never mind... The module class was in src/test/java not src/main/java.
>
> <Walks off with tail between legs>
>
>
> -----Original Message-----
> From: Joel Wiegman [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 29, 2008 1:41 PM
> To: Tapestry users
> Subject: T5: Simple Module not loading [5.0.9]
>
> All,
>
> Let me tell you a quick story... Got an error in my app which I'm sure
> some of you have seen:
>
> Failure writing parameter value of component
> app/controllist/consignment/EditControl:departmentid: Coercion of null
> to type java.lang.Integer (via null --> String, String --> Long, Long
> --> Integer) failed: null
>
> I thought to myself... well I guess that makes sense... let me add a
> Module definition and contribute the coercion for nulls to Integers.
>
> So I check my web xml (abridged):
>
>         <context-param>
>                 <param-name>tapestry.app-package</param-name>
>                 <param-value>com.foo.web</param-value>
>         </context-param>
>
>         <filter>
>                 <filter-name>app</filter-name>
>
> <filter-class>org.apache.tapestry.spring.TapestrySpringFilter</filter-cl
> ass>
>         </filter>
>
> And conclude that I need to create the following file:
>
>     package com.foo.web.services;
>
>     import org.apache.tapestry.ioc.Configuration;
>     import org.apache.tapestry.ioc.services.Coercion;
>     import org.apache.tapestry.ioc.services.CoercionTuple;
>
>     public class AppModule {
>
>         public static void contributeTypeCoercer(
>                         Configuration<CoercionTuple> configuration) {
>
>                 System.out.println("Coercion added!");
>
>                 add(configuration, void.class, Integer.class,
>                                 new Coercion<Void, Integer>() {
>                                         public Integer coerce(Void
> input) {
>                                                 return null;
>                                         }
>                                 });
>         }
>
>         private static <S, T> void add(Configuration<CoercionTuple>
> configuration,
>                         Class<S> sourceType, Class<T> targetType,
> Coercion<S, T> coercion) {
>                 CoercionTuple<S, T> tuple = new CoercionTuple<S,
> T>(sourceType,
>                                 targetType, coercion);
>
>                 configuration.add(tuple);
>         }
>
>     }
>
> Problem is... I never see the System.out, so I can only assume that my
> module never loaded (and of course, I still get the error).
>
> Can anyone spot my flaw?  I'm totally stumped.
>
> Joel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to