There is also a constructor that will take a Class type as a parameter.

On Thu, Jul 22, 2010 at 3:11 PM, T Ames <[email protected]> wrote:

> I think you have to use the setType(Integer.class) method on the TextField
> object.
>
> setType
>
> public final FormComponent
>
> <file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html><T
>
> <file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html>>
> *setType*(java.lang.Class<?> type)
>
> Sets the type that will be used when updating the model for this component.
> If no type is specified String type is assumed.
>
>  *Parameters:*type - *Returns:*this for chaining
>
> On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson <
> [email protected]> wrote:
>
> > Has anybody succesfully used TextField<Integer>?
> >
> > I get an runtime exception trying to cast String to Integer.
> >
> > If supply (Integer.class) to the constructor then it is trying to case
> Long
> > to Integer.
> >
> > D/
> >
>

Reply via email to