I see, I'll try it again.  So, that being said, when can I be sure I'm not using a bookmarkable page?  I noticed that on some requests the "bookmarkable "querystring is used and on others...the "path" is used.

I apologize if I'm asking annoying n00b questions, I'm trying to cram Wicket into my head and into a small proof-of-concept project to convince my boss to let me use it on future projects (now that we're migrating to Java.)

Thanks again!

On 3/15/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
sounds like you are on the right place. you dont have to use the default constructor. the default/PageParameters constructor is only needed if this page is going to be accessed through a bookmarkable url. outside of that you are welcome to use any constructor you want.

-Igor



On 3/15/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
I'm trying to wrap my head around how I would create a page where I could either edit an existing record or create a new one.

Currently, I've got a form where I can add a record to the database - that part is working great.  I'd like to refactor it now to also edit an existing record, if there is one.  The user would choose a record from a ListView below the form and the form would be populated w/ the values of that entity bean.  The user would change values and then submit the form.

My first idea was to pass the object into the constructor of the page class:

public EditProduct(Product editProduct)

...and then decide inside the constructor whether or not to create a new Product object or use the one passed in:

        //edit or new?
        Product p = null;       
        if (editProduct == null)
            p = new Product();
        else
            p = editProduct;

I would then pass the Product into the form:

add(new EditProductForm("editProductForm", p));

...which would be bound like so:

        public EditProductForm(String name, Product product)
        {
            super(name, new CompoundPropertyModel(product));
..........

However, I didn't realize you had to do everything within the *default* constructor of the WebPage derived class...oops!  I start to see this exception all over again:

wicket.markup.MarkupException : Unable to find component with id 'headerPanel' in......

Am I making this more complicated than it needs to be?  What is a better approach?

Thanks!


Reply via email to