make a test case for a case where you expect the page to be expiring.

setEnabled on page shouldn't do to much i think by itself
But i guess the component where you click on then is disabeld because of the
isEnabledInHierarchy check
So then it can't call the action again on it.


On 10/28/07, Suad AlShamsi <[EMAIL PROTECTED]> wrote:
>
> You are right. I should not have remove the page from the constructor.
>
> I place *getPageMap().remove(this);*  after the setResponsePage in all
> the pages. What is happening is
>
> From Page 1 to Page 2 when using the back button the page expired
> From Page 2 to Page 3 when using the back button the page *NOT* expiring
> From Page 3 to Page 4 when using the back button the page expired
>
>
> I do not know why is it so. From Page 2 to Page 3 I am sending an object
> that holds the input data. So, Could it be the reason for such a behavior.
>
> By the why in Page 2 if I call this.setEnabled(false); after
> *getPageMap().remove(this);* when using the browser back button the page
> is getting expired.
>
> Any idea what is happening?!
>
> Regards,
> Suad
>
> Johan Compagner wrote:
> > You can't call remove from page map from Inside the page constructor!!
> > it isn't even IN the pagemap yet because the page is not yet constructed
> > and why do you think you do? why would you remove a page from the
> pagemap
> > when you still construct it and want to use it also again as a request
> page
> > (i see links on in...)
> >
> > public class WelcomePage extends BasePage
> > {
> >     public WelcomePage()
> >     {
> >         add(new Link("RegistrationFormLink"){
> >             public void onClick()
> >             {
> >                 setResponsePage(new RegisterationPage());
> >                 *getPageMap().remove(this);*
> >             }
> >         });
> >     }
> > }
> >
> > above code should work i hope. The only thing i don't know currently if
> it
> > works correctly
> > is that when you call remove maybe the detach phase of the page is then
> > putting it back in
> > (Matej? do will support this still with all the new changes??)
> >
> > johan
> >
> >
> >
> > On 10/27/07, Suad AlShamsi <[EMAIL PROTECTED]> wrote:
> >
> >> I am using wicket 1.3 bita4 and all what really need is whenever the
> user
> >> is navigating using the browser back and forward button is to see page
> >> expired.
> >> Here is snap of my code. Can you please tell me what am doing wrong
> >>
> >> *Page 1 (Home Page)
> >> *public class WelcomePage extends BasePage
> >> {
> >>     public WelcomePage()
> >>     {
> >>         add(new Link("RegistrationFormLink"){
> >>             public void onClick()
> >>             {
> >>                 setResponsePage(new RegisterationPage());
> >>             }
> >>         });
> >>         *this.getPageMap().remove(this);*
> >>     }
> >> }
> >>
> >> *Page 2
> >> *public class RegisterationPage extends BasePage
> >> {
> >>     private Individual user;
> >>     public RegisterationPage()
> >>     {
> >>         user = new Individual();
> >>         add(new RegisterationForm("regForm", new
> >> CompoundPropertyModel(user)));
> >>
> >> *        this.getPageMap().remove(this);*
> >>     }
> >>     private class RegisterationForm extends Form
> >>     {
> >>
> >>         public RegisterationForm(String name, CompoundPropertyModel
> model)
> >>         {
> >>             super(name, model);
> >>
> >>             //Form Fields
> >>            *** Adding some fields to the form
> >>
> >>         public void onSubmit()
> >>         {
> >>                  ConfirmationPage confPage = new
> ConfirmationPage(user);
> >>                 setResponsePage(confPage);
> >> *                this.getPage().getPageMap().remove(this.getPage());*
> >>         }
> >>     }
> >> }
> >>
> >> *Page 3*
> >>
> >> public class ConfirmationPage extends BasePage
> >> {
> >>     private Individual user;
> >>
> >>     public ConfirmationPage(Individual ind)
> >>     {
> >>         add(new InputForm("confForm", new CompoundPropertyModel(user));
> >> *        this.getPageMap().remove(this);*
> >>     }
> >>     private class InputForm extends Form
> >>     {
> >>         public InputForm(String name, CompoundPropertyModel model)
> >>         {
> >>             super(name, model);
> >>
> >>             //Form Fields
> >>             ***adding Some fields
> >>         }
> >>         public void onSubmit()
> >>         {
> >>                 setResponsePage(new SucessPage());
> >> *                this.getPage().getPageMap().remove(this.getPage());*
> >>         }
> >>     }
> >> }
> >> *Page 4*
> >> public class SucessPage extends BasePage
> >> {
> >>     public SucessPage()
> >>     {
> >>         //Construct form feedback, and link panel and hook them up
> >>         final FeedbackPanel feedback = new FeedbackPanel("feedback");
> >>         add(feedback);
> >>
> >> *        this.getPageMap().remove(this);*
> >>     }
> >> }
> >>
> >>
> >> Regards,
> >> Suad
> >> *
> >> *
> >> Johan Compagner wrote:
> >>
> >> what do you mean you added the above call to all the pages?
> >> How do you do that?
> >>
> >>
> >> On 10/26/07, Suad AlShamsi <[EMAIL PROTECTED]> wrote:
> >>
> >>>  --> PageMap.clear should work but it is a bit strange call to do. Why
> >>> do you want
> >>>         to delete all pages? But what do you say nothing happens? What
> >>> do you expect to see happening?
> >>>
> >>>        These pages are public pages used for user registration which
> >>> takes number of steps to complete. I dont want the user to use the
> back
> >>> button to reset any of the previous forms. I want the page to expired
> in
> >>> case the user is using the back button. But the pages are not getting
> >>> expired.
> >>>
> >>>
> >>> Page.getPageMap().remove(Page)
> >>>
> >>> I added the above call to all the pages but it only expires the first
> >>> page.
> >>>
> >>> Suad
> >>>
> >>>
> >>> Johan Compagner wrote:
> >>>
> >>> PageMap.clear should work but it is a bit strange call to do. Why do
> you
> >>> want
> >>> to delete all pages? But what do you say nothing happens? What do you
> >>> expect to see happening?
> >>>
> >>>
> >>> And with Page.remove() is the wrong call, that is the default call to
> >>> remove a component from its parent
> >>> Maybe we should implement that that it call the pagemap and removes
> >>> itself
> >>> (but it is final at the moment)
> >>>
> >>> Page.getPageMap().remove(Page)
> >>>
> >>> johan
> >>>
> >>>
> >>> On 10/26/07, Suad AlShamsi <[EMAIL PROTECTED] > wrote:
> >>>
> >>>> Removing the page is throwing the following exception:
> >>>>
> >>>> Caused by: java.lang.IllegalStateException : Cannot remove [Page
> class
> >>>> =
> >>>> com.individual.registration.RegisterationPage, id = 6, version = 0]
> >>>> from
> >>>> null parent!
> >>>>    at org.apache.wicket.Component.remove(Component.java:1896)
> >>>>
> >>>> What I have is 3 pages. Page 1 has a form component, Page 2 has
> >>>> another
> >>>> form components, and Page 3 is has a label component. After
> submitting
> >>>> the form on page 1 the user will be directed to page 2 and after
> >>>> submitting the form the user will  be directed to page 3. What I want
> >>>> to
> >>>> prevent the user from using the browser back button after submitting
> >>>> the
> >>>> form. The user should get the page has been expired.
> >>>>
> >>>> I tried getPageMap().clear(); after setResponsePage(page); in
> >>>> onSubmit()
> >>>> but nothing happen. Then I tried getPage().remove(); I got the
> >>>> exception
> >>>> mentioned earlier. Please help me.
> >>>>
> >>>> Regards,
> >>>> Suad
> >>>>
> >>>>
> >>>> Johan Compagner wrote:
> >>>>
> >>>>> call remove page then the page is gone and can't be reconstructed
> >>>>>
> >>>> anymore
> >>>>
> >>>>> Ofcourse people can still use the back button (if the url did change
> >>>>>
> >>>> from
> >>>>
> >>>>> the first to the second page)
> >>>>> and when they do that they will get a page expired.
> >>>>> Or maybe on the second page you have some javascript that clears the
> >>>>>
> >>>> window
> >>>>
> >>>>> history somehow.
> >>>>>
> >>>>> johan
> >>>>>
> >>>>>
> >>>>>
> >>>>> On 10/25/07, Suad AlShamsi <[EMAIL PROTECTED]> wrote:
> >>>>>
> >>>>>
> >>>>>> Your right, actually what I need is to stop the browser back
> >>>>>>
> >>>> button, which
> >>>>
> >>>>>> means I need to disable the default second cache, writting to the
> >>>>>>
> >>>> file
> >>>>
> >>>>>> system. How can I do so.
> >>>>>>
> >>>>>> Another question, what is a temporary session, how can been
> >>>>>>
> >>>> created, when
> >>>>
> >>>>>> to use it?
> >>>>>>
> >>>>>> Johan Compagner wrote:
> >>>>>>
> >>>>>> you go to another page so the previous page is not in the session
> >>>>>>
> >>>> anymore
> >>>>
> >>>>>> (wicket 1.3)
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On 10/24/07, Suad AlShamsi <[EMAIL PROTECTED] > wrote:
> >>>>>>
> >>>>>>
> >>>>>>> Hi All,
> >>>>>>>    After submitting a form the input data will be persisted in the
> >>>>>>>
> >>>>>>> database and the user  will be directed to another page. How can I
> >>>>>>>
> >>>> clear
> >>>>
> >>>>>>> the input data from the session?!
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>
> >>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >
> >
>
>

Reply via email to