You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by James Perry <ja...@gmail.com> on 2007/11/05 13:39:02 UTC

Problem with selecting default value with DropDownChoice

I have a problem with the DropDownChoice. More specifically, I have a
Product class which is like:

public class Product implements Serializable {

    private static final long serialVersionUID = 1L;

    private Manufacturer manufacturer;
    //other states

    //getters and setters

}

I have a form which allows to edit a product, which allows to change the
manufacturer object with a DropDownChoice. However, an Xbox product for
instance, it should display its Microsoft manufacturer object as selected
but it selects 'Choose One' instead. Also, the setRequired for the
DropDownChoice does not work as it allows users to select 'Choose One'. I
notice it works with primitive types but not with my compositional objects.

Here is my EditProductPage:

package net.sourceforge.springcart.wicket.pages.admin;

public class EditProductPage extends AdminPage {

    private static final long serialVersionUID = 1L;

    @SpringBean(name = "adminService")
    private AdminService adminService;

    public EditProductPage() {
        this(new Product());
    }

    public EditProductPage(Product product) {
        MenuBorder border = new MenuBorder("libBorder");
        border.add(new EditProductForm("productForm", product));
        add(border);
    }

    private final class EditProductForm extends Form {

        public EditProductForm(String id, Product product) {
            super(id, new CompoundPropertyModel(product));
            add(new RequiredTextField("name"));
            add(new RequiredTextArea("description"));
            add(new RequiredTextField("sellValue", BigDecimal.class));
            add(new RequiredTextField("units", Long.class));
            add(new CheckBox("onSell").setRequired(true));
            add(new DropDownChoice("category", catalogService.getCategories
())
                    .setRequired(true));
            add(new DropDownChoice("manufacturer", catalogService
                    .getManufacturers()).setRequired(true));
        }

        @Override
        protected void onSubmit() {
            Product product = (Product) getModelObject();
            product.setEntryDate(new Timestamp(System.currentTimeMillis()));
            adminService.updateProduct(product);
            setResponsePage(ViewProductsPage.class);
        }

    }

}

Any advice please?

Cheers,
James.

Re: Problem with selecting default value with DropDownChoice

Posted by Dmitry Kandalov <no...@gmail.com>.
On Monday 05 November 2007 18:55:07 James Perry wrote:
> Also what about wrapping the List in a PropertyModel; would that help?
>
> On 11/5/07, James Perry <ja...@gmail.com> wrote:
> > Hello Dima,
> >
> > That was my initial assumption but I already have overrided my
> > equals()/hashCode() methods for Manufacturer's "business key" in
> > Hibernate and ensured my HQL query retrieves Manufacturer objects. Do I
> > need to add an implementation of IChoiceRendered as an argument to DDC?
> >
> > Thanks,
> > James.

I think wrapping list in PropertyModel won't help. You can add IChoiceRendered 
but it should work without it.

If you have wicket sources you can put breakpoint at 
AbstractSingleSelectChoice#getModelValue and see if object is really in the 
choices list.

Dima

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with selecting default value with DropDownChoice

Posted by James Perry <ja...@gmail.com>.
Also what about wrapping the List in a PropertyModel; would that help?

On 11/5/07, James Perry <ja...@gmail.com> wrote:
>
> Hello Dima,
>
> That was my initial assumption but I already have overrided my
> equals()/hashCode() methods for Manufacturer's "business key" in Hibernate
> and ensured my HQL query retrieves Manufacturer objects. Do I need to add an
> implementation of IChoiceRendered as an argument to DDC?
>
> Thanks,
> James.
>
> On 11/5/07, Dmitry Kandalov <no...@gmail.com> wrote:
> >
> > On Monday 05 November 2007 16:39:02 James Perry wrote:
> > > I have a problem with the DropDownChoice. More specifically, I have a
> > > Product class which is like:
> > >
> > > public class Product implements Serializable {
> > >
> > >     private static final long serialVersionUID = 1L;
> > >
> > >     private Manufacturer manufacturer;
> > >     //other states
> > >
> > >     //getters and setters
> > >
> > > }
> > >
> > > I have a form which allows to edit a product, which allows to change
> > the
> > > manufacturer object with a DropDownChoice. However, an Xbox product
> > for
> > > instance, it should display its Microsoft manufacturer object as
> > selected
> > > but it selects 'Choose One' instead.
> >
> > May be choices and value in the DDC are different java objects and you
> > didn't
> > implement equals(), hashCode() in Manufacturer class?
> >
> > Dima
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: Problem with selecting default value with DropDownChoice

Posted by James Perry <ja...@gmail.com>.
Spot on. I have accidently used == for String equality so that's why
it wasn't working. I have corrected it with .equals() and removed the
ChoiceRenderer and it works perfectly :-)

Cheers,
James.

On Nov 6, 2007 5:42 AM, Dmitry Kandalov <no...@gmail.com> wrote:
> On Tuesday 06 November 2007 00:55:23 James Perry wrote:
> > I empirically found out what the solution was to the problem of not
> > selecting the correct default choice of the Manufacturer within Product!
> >
> > I added a ChoiceRendered to the constructor of DDC and it did the trick!
>
> It seems like equals() doesn't work correctly.
>
>
> Dima
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with selecting default value with DropDownChoice

Posted by Dmitry Kandalov <no...@gmail.com>.
On Tuesday 06 November 2007 00:55:23 James Perry wrote:
> I empirically found out what the solution was to the problem of not
> selecting the correct default choice of the Manufacturer within Product!
>
> I added a ChoiceRendered to the constructor of DDC and it did the trick!

It seems like equals() doesn't work correctly.

Dima

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with selecting default value with DropDownChoice

Posted by Gwyn Evans <gw...@gmail.com>.
Hi James,

Monday, November 5, 2007, 8:05:58 PM, you wrote:

JP> Some notes I have observed. * All my objects within the list are
JP> correctly in the DDC * All my objects within the list have an
JP> implemented equals/hashcode. * It doesn't correctly pre-select
JP> both my Manufacturer associations within Product; it just goes to
JP> 'Choose One' * It correctly sets Manufacturer if we change the
JP> pre-selected 'Choose One' to any object within the DDC.

JP> So why is it not correctly pre-selecting? For example, my Xbox is not
JP> pre-selecting to Microsoft instead going to 'Choose One'.

I'm afraid that it does sound as if the pre-selected manufacturer
isn't matching the ones in the list, although I'd want to run through
the Wicket sources before I was happy it wasn't down to something like
an Object to String conversion going on somewhere. (Random guessing,
though.)

Maybe trying to reproduce it in a QuickStart would help - certainly
isolating the problem normally helps point to the issue and if not,
would let others investigate.

/Gwyn



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with selecting default value with DropDownChoice

Posted by James Perry <ja...@gmail.com>.
I empirically found out what the solution was to the problem of not
selecting the correct default choice of the Manufacturer within Product!

I added a ChoiceRendered to the constructor of DDC and it did the trick!

Here's the form:

    private final class EditProductForm extends Form {

        public EditProductForm(String id, Product product) {
            super(id, new CompoundPropertyModel(product));
            Product p = (Product) getModelObject();
            System.out.printf("category: %s", product.getCategory
().getName());
            System.out.printf("manufacturer: %s", product.getManufacturer
().getName());

            add(new RequiredTextField("name"));
            add(new RequiredTextArea("description"));
            add(new RequiredTextField("sellValue", BigDecimal.class));
            add(new RequiredTextField("units", Long.class));
            add(new CheckBox("onSell").setRequired(true));
            add(new DropDownChoice("category", catalogService.getCategories
(),
                    new ChoiceRenderer("name", "id")));
            add(new DropDownChoice("manufacturer", catalogService
                    .getManufacturers(), new ChoiceRenderer("name", "id")));
        }

        @Override
        protected void onSubmit() {
            Product product = (Product) getModelObject();
            product.setEntryDate(new Timestamp(System.currentTimeMillis()));
            adminService.updateProduct(product);
            setResponsePage(ViewProductsPage.class);
        }

    }

Cheers for all the help!

Best,
James.

On 11/5/07, James Perry <ja...@gmail.com> wrote:
>
> Some notes I have observed.
>
> * All my objects within the list are correctly in the DDC
> * All my objects within the list have an implemented equals/hashcode.
> * It doesn't correctly pre-select both my Manufacturer associations within
> Product; it just goes to 'Choose One'
> * It correctly sets Manufacturer if we change the pre-selected 'Choose
> One' to any object within the DDC.
>
> So why is it not correctly pre-selecting? For example, my Xbox is not
> pre-selecting to Microsoft instead going to 'Choose One'.
>
> Cheers,
> James.
>
> On 11/5/07, James Perry <ja...@gmail.com> wrote:
> >
> > Hello all,
> >
> > Thanks for the replies so far.
> >
> > Well I have taken the feedback and my manufacturer object and category
> > object are certainly are there when it passed to my form.
> >
> > It is really bizarre as if I select a manufactuer and persist the
> > product obejct upon the form's onSubmit, it's correctly persisted. So I
> > don't understand why it can correctly set the manufacturer object when
> > changing a manufacturer yet it doesn't select the correct manufacturer upon
> > going to EditProductPage.
> >
> > Any thoughts? I tried it with a RadioChoice and it has the same problem.
> > :-(
> >
> > On 11/5/07, Gwyn Evans < gwyn.evans@gmail.com> wrote:
> > >
> > > Hi James,
> > >
> > > While the implementation's not a big deal, and you'll probably want
> > > one, "Choose One" is the default for when the selected (or
> > > pre-selected) item's not found in the DDC list of values, so I don't
> > > think it's directly that.  I'd be tempted to double-check (either via
> > > logging or via a debugger) that all the data's there as expected
> > > (although an anonymous implementation of a IChoiceRender's as good a
> > > way as any of having somewhere to set a breakpoint!)
> > >
> > > /Gwyn
> > >
> > > Monday, November 5, 2007, 2:54:09 PM, you wrote:
> > >
> > > JP> Hello Dima,
> > >
> > > JP> That was my initial assumption but I already have overrided my
> > > JP> equals()/hashCode() methods for Manufacturer's "business key" in
> > > Hibernate
> > > JP> and ensured my HQL query retrieves Manufacturer objects. Do I need
> > > to add an
> > > JP> implementation of IChoiceRendered as an argument to DDC?
> > >
> > > JP> Thanks,
> > > JP> James.
> > >
> > > JP> On 11/5/07, Dmitry Kandalov < no.mail.su@gmail.com> wrote:
> > > >>
> > > >> On Monday 05 November 2007 16:39:02 James Perry wrote:
> > > >> > I have a problem with the DropDownChoice. More specifically, I
> > > have a
> > > >> > Product class which is like:
> > > >> >
> > > >> > public class Product implements Serializable {
> > > >> >
> > > >> >     private static final long serialVersionUID = 1L;
> > > >> >
> > > >> >     private Manufacturer manufacturer;
> > > >> >     //other states
> > > >> >
> > > >> >     //getters and setters
> > > >> >
> > > >> > }
> > > >> >
> > > >> > I have a form which allows to edit a product, which allows to
> > > change the
> > > >> > manufacturer object with a DropDownChoice. However, an Xbox
> > > product for
> > > >> > instance, it should display its Microsoft manufacturer object as
> > > >> selected
> > > >> > but it selects 'Choose One' instead.
> > > >>
> > > >> May be choices and value in the DDC are different java objects and
> > > you
> > > >> didn't
> > > >> implement equals(), hashCode() in Manufacturer class?
> > > >>
> > > >> Dima
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>

Re: Problem with selecting default value with DropDownChoice

Posted by James Perry <ja...@gmail.com>.
Some notes I have observed.

* All my objects within the list are correctly in the DDC
* All my objects within the list have an implemented equals/hashcode.
* It doesn't correctly pre-select both my Manufacturer associations within
Product; it just goes to 'Choose One'
* It correctly sets Manufacturer if we change the pre-selected 'Choose One'
to any object within the DDC.

So why is it not correctly pre-selecting? For example, my Xbox is not
pre-selecting to Microsoft instead going to 'Choose One'.

Cheers,
James.

On 11/5/07, James Perry <ja...@gmail.com> wrote:
>
> Hello all,
>
> Thanks for the replies so far.
>
> Well I have taken the feedback and my manufacturer object and category
> object are certainly are there when it passed to my form.
>
> It is really bizarre as if I select a manufactuer and persist the product
> obejct upon the form's onSubmit, it's correctly persisted. So I don't
> understand why it can correctly set the manufacturer object when changing a
> manufacturer yet it doesn't select the correct manufacturer upon going to
> EditProductPage.
>
> Any thoughts? I tried it with a RadioChoice and it has the same problem.
> :-(
>
> On 11/5/07, Gwyn Evans < gwyn.evans@gmail.com> wrote:
> >
> > Hi James,
> >
> > While the implementation's not a big deal, and you'll probably want
> > one, "Choose One" is the default for when the selected (or
> > pre-selected) item's not found in the DDC list of values, so I don't
> > think it's directly that.  I'd be tempted to double-check (either via
> > logging or via a debugger) that all the data's there as expected
> > (although an anonymous implementation of a IChoiceRender's as good a
> > way as any of having somewhere to set a breakpoint!)
> >
> > /Gwyn
> >
> > Monday, November 5, 2007, 2:54:09 PM, you wrote:
> >
> > JP> Hello Dima,
> >
> > JP> That was my initial assumption but I already have overrided my
> > JP> equals()/hashCode() methods for Manufacturer's "business key" in
> > Hibernate
> > JP> and ensured my HQL query retrieves Manufacturer objects. Do I need
> > to add an
> > JP> implementation of IChoiceRendered as an argument to DDC?
> >
> > JP> Thanks,
> > JP> James.
> >
> > JP> On 11/5/07, Dmitry Kandalov < no.mail.su@gmail.com> wrote:
> > >>
> > >> On Monday 05 November 2007 16:39:02 James Perry wrote:
> > >> > I have a problem with the DropDownChoice. More specifically, I have
> > a
> > >> > Product class which is like:
> > >> >
> > >> > public class Product implements Serializable {
> > >> >
> > >> >     private static final long serialVersionUID = 1L;
> > >> >
> > >> >     private Manufacturer manufacturer;
> > >> >     //other states
> > >> >
> > >> >     //getters and setters
> > >> >
> > >> > }
> > >> >
> > >> > I have a form which allows to edit a product, which allows to
> > change the
> > >> > manufacturer object with a DropDownChoice. However, an Xbox product
> > for
> > >> > instance, it should display its Microsoft manufacturer object as
> > >> selected
> > >> > but it selects 'Choose One' instead.
> > >>
> > >> May be choices and value in the DDC are different java objects and
> > you
> > >> didn't
> > >> implement equals(), hashCode() in Manufacturer class?
> > >>
> > >> Dima
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: Problem with selecting default value with DropDownChoice

Posted by James Perry <ja...@gmail.com>.
Hello all,

Thanks for the replies so far.

Well I have taken the feedback and my manufacturer object and category
object are certainly are there when it passed to my form.

It is really bizarre as if I select a manufactuer and persist the product
obejct upon the form's onSubmit, it's correctly persisted. So I don't
understand why it can correctly set the manufacturer object when changing a
manufacturer yet it doesn't select the correct manufacturer upon going to
EditProductPage.

Any thoughts? I tried it with a RadioChoice and it has the same problem. :-(


On 11/5/07, Gwyn Evans <gw...@gmail.com> wrote:
>
> Hi James,
>
> While the implementation's not a big deal, and you'll probably want
> one, "Choose One" is the default for when the selected (or
> pre-selected) item's not found in the DDC list of values, so I don't
> think it's directly that.  I'd be tempted to double-check (either via
> logging or via a debugger) that all the data's there as expected
> (although an anonymous implementation of a IChoiceRender's as good a
> way as any of having somewhere to set a breakpoint!)
>
> /Gwyn
>
> Monday, November 5, 2007, 2:54:09 PM, you wrote:
>
> JP> Hello Dima,
>
> JP> That was my initial assumption but I already have overrided my
> JP> equals()/hashCode() methods for Manufacturer's "business key" in
> Hibernate
> JP> and ensured my HQL query retrieves Manufacturer objects. Do I need to
> add an
> JP> implementation of IChoiceRendered as an argument to DDC?
>
> JP> Thanks,
> JP> James.
>
> JP> On 11/5/07, Dmitry Kandalov <no...@gmail.com> wrote:
> >>
> >> On Monday 05 November 2007 16:39:02 James Perry wrote:
> >> > I have a problem with the DropDownChoice. More specifically, I have a
> >> > Product class which is like:
> >> >
> >> > public class Product implements Serializable {
> >> >
> >> >     private static final long serialVersionUID = 1L;
> >> >
> >> >     private Manufacturer manufacturer;
> >> >     //other states
> >> >
> >> >     //getters and setters
> >> >
> >> > }
> >> >
> >> > I have a form which allows to edit a product, which allows to change
> the
> >> > manufacturer object with a DropDownChoice. However, an Xbox product
> for
> >> > instance, it should display its Microsoft manufacturer object as
> >> selected
> >> > but it selects 'Choose One' instead.
> >>
> >> May be choices and value in the DDC are different java objects and you
> >> didn't
> >> implement equals(), hashCode() in Manufacturer class?
> >>
> >> Dima
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Problem with selecting default value with DropDownChoice

Posted by Gwyn Evans <gw...@gmail.com>.
Hi James,

While the implementation's not a big deal, and you'll probably want
one, "Choose One" is the default for when the selected (or
pre-selected) item's not found in the DDC list of values, so I don't
think it's directly that.  I'd be tempted to double-check (either via
logging or via a debugger) that all the data's there as expected
(although an anonymous implementation of a IChoiceRender's as good a
way as any of having somewhere to set a breakpoint!)

/Gwyn

Monday, November 5, 2007, 2:54:09 PM, you wrote:

JP> Hello Dima,

JP> That was my initial assumption but I already have overrided my
JP> equals()/hashCode() methods for Manufacturer's "business key" in Hibernate
JP> and ensured my HQL query retrieves Manufacturer objects. Do I need to add an
JP> implementation of IChoiceRendered as an argument to DDC?

JP> Thanks,
JP> James.

JP> On 11/5/07, Dmitry Kandalov <no...@gmail.com> wrote:
>>
>> On Monday 05 November 2007 16:39:02 James Perry wrote:
>> > I have a problem with the DropDownChoice. More specifically, I have a
>> > Product class which is like:
>> >
>> > public class Product implements Serializable {
>> >
>> >     private static final long serialVersionUID = 1L;
>> >
>> >     private Manufacturer manufacturer;
>> >     //other states
>> >
>> >     //getters and setters
>> >
>> > }
>> >
>> > I have a form which allows to edit a product, which allows to change the
>> > manufacturer object with a DropDownChoice. However, an Xbox product for
>> > instance, it should display its Microsoft manufacturer object as
>> selected
>> > but it selects 'Choose One' instead.
>>
>> May be choices and value in the DDC are different java objects and you
>> didn't
>> implement equals(), hashCode() in Manufacturer class?
>>
>> Dima



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with selecting default value with DropDownChoice

Posted by James Perry <ja...@gmail.com>.
Hello Dima,

That was my initial assumption but I already have overrided my
equals()/hashCode() methods for Manufacturer's "business key" in Hibernate
and ensured my HQL query retrieves Manufacturer objects. Do I need to add an
implementation of IChoiceRendered as an argument to DDC?

Thanks,
James.

On 11/5/07, Dmitry Kandalov <no...@gmail.com> wrote:
>
> On Monday 05 November 2007 16:39:02 James Perry wrote:
> > I have a problem with the DropDownChoice. More specifically, I have a
> > Product class which is like:
> >
> > public class Product implements Serializable {
> >
> >     private static final long serialVersionUID = 1L;
> >
> >     private Manufacturer manufacturer;
> >     //other states
> >
> >     //getters and setters
> >
> > }
> >
> > I have a form which allows to edit a product, which allows to change the
> > manufacturer object with a DropDownChoice. However, an Xbox product for
> > instance, it should display its Microsoft manufacturer object as
> selected
> > but it selects 'Choose One' instead.
>
> May be choices and value in the DDC are different java objects and you
> didn't
> implement equals(), hashCode() in Manufacturer class?
>
> Dima
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Problem with selecting default value with DropDownChoice

Posted by Dmitry Kandalov <no...@gmail.com>.
On Monday 05 November 2007 16:39:02 James Perry wrote:
> I have a problem with the DropDownChoice. More specifically, I have a
> Product class which is like:
>
> public class Product implements Serializable {
>
>     private static final long serialVersionUID = 1L;
>
>     private Manufacturer manufacturer;
>     //other states
>
>     //getters and setters
>
> }
>
> I have a form which allows to edit a product, which allows to change the
> manufacturer object with a DropDownChoice. However, an Xbox product for
> instance, it should display its Microsoft manufacturer object as selected
> but it selects 'Choose One' instead. 

May be choices and value in the DDC are different java objects and you didn't 
implement equals(), hashCode() in Manufacturer class?

Dima

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Problem with selecting default value with DropDownChoice

Posted by Frank Bille <fr...@apache.org>.
Provide a ChoiceRenderer to the DropDownChoice constructor. It's in the ID
part of it.

Frank

On 11/5/07, James Perry <ja...@gmail.com> wrote:
>
> I have a problem with the DropDownChoice. More specifically, I have a
> Product class which is like:
>
> public class Product implements Serializable {
>
>     private static final long serialVersionUID = 1L;
>
>     private Manufacturer manufacturer;
>     //other states
>
>     //getters and setters
>
> }
>
> I have a form which allows to edit a product, which allows to change the
> manufacturer object with a DropDownChoice. However, an Xbox product for
> instance, it should display its Microsoft manufacturer object as selected
> but it selects 'Choose One' instead. Also, the setRequired for the
> DropDownChoice does not work as it allows users to select 'Choose One'. I
> notice it works with primitive types but not with my compositional
> objects.
>
> Here is my EditProductPage:
>
> package net.sourceforge.springcart.wicket.pages.admin;
>
> public class EditProductPage extends AdminPage {
>
>     private static final long serialVersionUID = 1L;
>
>     @SpringBean(name = "adminService")
>     private AdminService adminService;
>
>     public EditProductPage() {
>         this(new Product());
>     }
>
>     public EditProductPage(Product product) {
>         MenuBorder border = new MenuBorder("libBorder");
>         border.add(new EditProductForm("productForm", product));
>         add(border);
>     }
>
>     private final class EditProductForm extends Form {
>
>         public EditProductForm(String id, Product product) {
>             super(id, new CompoundPropertyModel(product));
>             add(new RequiredTextField("name"));
>             add(new RequiredTextArea("description"));
>             add(new RequiredTextField("sellValue", BigDecimal.class));
>             add(new RequiredTextField("units", Long.class));
>             add(new CheckBox("onSell").setRequired(true));
>             add(new DropDownChoice("category",
> catalogService.getCategories
> ())
>                     .setRequired(true));
>             add(new DropDownChoice("manufacturer", catalogService
>                     .getManufacturers()).setRequired(true));
>         }
>
>         @Override
>         protected void onSubmit() {
>             Product product = (Product) getModelObject();
>             product.setEntryDate(new Timestamp(System.currentTimeMillis
> ()));
>             adminService.updateProduct(product);
>             setResponsePage(ViewProductsPage.class);
>         }
>
>     }
>
> }
>
> Any advice please?
>
> Cheers,
> James.
>