Hi,

I've found the following pattern to work very well - at least I use it everywhere on several sites in production with no problems. :)

  @Property
  private Item item;

  // I have a form in my template with t:id="add"
  void onPrepareFromAdd() {
    if (null == item) item = new Item();
  }

  void onSuccessFromAdd() {
    // go about my business with the item
    ...
    // I'd normally return here, but since you need
    // something done in onSubmit...
  }

  Object onSubmitFromAdd() {
    // do what you need to do
    return ...;
  }

I sometimes persist the item if needed.

Hope this helps.

-Filip

On 2008-05-17 16:01, Manuel Corrales wrote:
Hi, here is my problem. I have a bean on my java page, but i am not using
the beaneditorform component to create a new one. Acording to Alexander
book, the beaneditorform component can handle the initialization of the
bean, so you dont have to create one. As i am not using this component,
should i define the bean with a sentence like this:

private Matafuego matafuego = new Matafuego();

or should i create the new instance on the onActivate method?

I tryied the first approach, but the bean is always the same (i guess
because of the page pooling mechanism). What is the right approach to this?

Thanks very much.


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

Reply via email to