no if you call on any component setResponsePage()
then that page is set as the response at the time of the call.
It is not internal state of that component that is then somehow picked up at
some point....

A component/page doesn't have a "default" response page.. (the default
response page is the page that is just rendered)

So yes if you want to go back to a calling page then you have to give that
to the constructor.

johan


On Tue, Mar 25, 2008 at 1:42 PM, Eric Rotick <[EMAIL PROTECTED]> wrote:

> Thanks for the help, I'm getting there...slowly!
>
> Does this mean that I can't do something like
>
> new MyPage1( ).setResponsePage( new MyPage2( ) );
>
> and then somewhere else
>
> new MyPage1( ).setResponsePage( new MyPage3( ) );
>
> Instead I have to add a parameter to all pages that could have a variable
> response page and set that via the setReponsePage in an onSubmit call. As
> in
>
> new MyPage1( new MyPage2( ) );
>
> and
>
> new MyPage1( new MyPage3( ) );
>
> After all, the default response page is the page itself. All that is
> happening is resetting the default response page to something else.
>
> Be gentle ;->
>
> Eric.
>
>
> On Tue, Mar 25, 2008 at 12:24 PM, Johan Compagner <[EMAIL PROTECTED]>
> wrote:
>
> > We really should remove all the RequestCycle methods from components if
> i
> > read these kind of mails....
> >
> > form.setResponsePage() doesn't mean that in the onSubmit that page is
> set
> > as
> > a response!
> >
> > That is something you should do yourself yes in the onSubmit()
> > you dont have to do then form.xxxx
> > just setResponsePage() is enough
> >
> > those methods are just all helper methods that are nothing more then
> > relays
> > to the RequestCycle
> >
> > You dont set state on the Object itself (like here form)
> >
> > johan
> >
> >
> > On Tue, Mar 25, 2008 at 1:08 PM, Eric Rotick <[EMAIL PROTECTED]>
> wrote:
> >
> > > I have simplified the class and it behaves the same.
> > >
> > > public class SingleItemForm extends Panel {
> > >
> > >    public SingleItemForm(
> > >        String id,
> > >        final boolean readonly,
> > >        final ISingleDisplay display,
> > >        final IModel model,
> > >        final Page callingPage
> > >    )
> > >    {
> > >        super( id );
> > >
> > >        add( new FeedbackPanel ("feedback" ) );
> > >
> > >        final Form form = new Form( "SingleItemFormName" );
> > >        // Call here has no effect
> > >        if( callingPage != null ) {
> > >            form.setResponsePage( callingPage );
> > >        }
> > >
> > >        RepeatingView rv = new RepeatingView( "SingleItemFormContents"
> );
> > >        for( Iterator views = display.getViews( ).iterator( );
> > > views.hasNext(
> > > ); ) {
> > >            IView view = (IView) views.next( );
> > >            rv.add( new FieldSetView( rv.newChildId( ), readonly,
> > display,
> > > model, view )  );
> > >        }
> > >        form.add( rv );
> > >
> > >        form.add( new SubmitLink( "link1" ) {
> > >            public void onSubmit( ) {
> > >                display.getData( ).saveItem( model.getObject( ) );
> > >                // Call here works
> > >                if( callingPage != null ) {
> > >                    form.setResponsePage( callingPage );
> > >                }
> > >            }
> > >        } );
> > >
> > >        add( form );
> > >    }
> > >
> > > }
> > >
> > >
> > >
> > > On Tue, Mar 25, 2008 at 11:32 AM, Johan Compagner <
> [EMAIL PROTECTED]>
> > > wrote:
> > >
> > > > do you have some sample code??
> > > > what do you mean with setResponsePage outside of an onSubmit or
> click?
> > > > outside of what? when is it called?
> > > >
> > > > On Tue, Mar 25, 2008 at 12:22 PM, Eric Rotick <[EMAIL PROTECTED]>
> > > > wrote:
> > > >
> > > > > I have a page with many buttons to do different things. I decided
> > the
> > > > best
> > > > > strategy was to setup the default page via a call to
> setReponsePage
> > at
> > > > the
> > > > > start of the page and then overrride this in the onSubmit method
> for
> > > > each
> > > > > button.
> > > > >
> > > > > This appears not to work. However, if I set a value of the default
> > > page
> > > > > and
> > > > > override this value in the onSubmit method of each button and then
> > > only
> > > > > call
> > > > > the setResponsePage in the obSubmit method for the form then it
> > works.
> > > > > I've
> > > > > also tried only making the call to setResponsePage in the onSubmit
> > or
> > > > > onClick methods and this works.
> > > > >
> > > > > In summary, a call to setReponsePage outside of an onSubmit or
> > onClick
> > > > > appears to have no effect.
> > > > >
> > > > > Is this correct and if so why? I can't find any docs to suggest
> not
> > > > using
> > > > > this strategy.
> > > > >
> > > >
> > >
> >
>

Reply via email to