You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Henrique <qu...@gmail.com> on 2010/11/10 01:07:00 UTC

RestartResponseAtInterceptPageException issue

Hello, I'll try to make this simple.
User fills in some data, clicks submit to persist it but since he has
to login first, he is redirected to a login page (via throw new
RestartResponseAtInterceptPageException(Login.class); ).
He logs in and is redirected back to the original page (via
continueToOriginalDestination() )

Now that he is back in the original page, even though the data he
entered into the form's components (textfields) are still there, the
onSubmit() method on this form does not respond, so the data cannot be
saved into the database.

Here is the onSubmit() method in the original page:
   	public void onSubmit() {

    		Item item = (Item)getModelObject();
    		
    		if(!UserLoggedInSession.get().isLoggedIn()) {
    			throw new RestartResponseAtInterceptPageException(Login.class);
    		}

    		// UNREACHABLE CODE WHEN THE USER COMES BACK FROM THE LOGIN PAGE!!!
    		User user = UserLoggedInSession.get().getUser();
    		item.setUser(user);
    		ItemDAO.persist(item);
    		setResponsePage(UserHomePage.class);
    	}

Any help is appreciated.
btw, if someone replies to this, how do I answer back? (i am viewing
this mailing list through mark mail)

Thanks.

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


Re: RestartResponseAtInterceptPageException issue

Posted by Igor Vaynberg <ig...@gmail.com>.
On Tue, Nov 9, 2010 at 4:07 PM, Henrique <qu...@gmail.com> wrote:
> Hello, I'll try to make this simple.
> User fills in some data, clicks submit to persist it but since he has
> to login first, he is redirected to a login page (via throw new
> RestartResponseAtInterceptPageException(Login.class); ).
> He logs in and is redirected back to the original page (via
> continueToOriginalDestination() )
>
> Now that he is back in the original page, even though the data he
> entered into the form's components (textfields) are still there, the
> onSubmit() method on this form does not respond, so the data cannot be
> saved into the database.
>
> Here is the onSubmit() method in the original page:
>        public void onSubmit() {
>
>                Item item = (Item)getModelObject();
>
>                if(!UserLoggedInSession.get().isLoggedIn()) {
>                        throw new RestartResponseAtInterceptPageException(Login.class);
>                }
>
>                // UNREACHABLE CODE WHEN THE USER COMES BACK FROM THE LOGIN PAGE!!!
>                User user = UserLoggedInSession.get().getUser();
>                item.setUser(user);
>                ItemDAO.persist(item);
>                setResponsePage(UserHomePage.class);
>        }
>
> Any help is appreciated.

restart response at intercept exception does not support forms because
it only keeps the url of the page not form values. form values are
showing up because the browser remembers them, probably wont be the
case for every browser. you lucked out.

as for the actual problem i am afraid you are going to have to debug
the code and see why it never reaches onsubmit.

> btw, if someone replies to this, how do I answer back? (i am viewing
> this mailing list through mark mail)

same way you posted this message...

-igor
>
> Thanks.
>
> ---------------------------------------------------------------------
> 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