You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kent Larsson <ke...@gmail.com> on 2009/05/21 21:04:32 UTC
Bookmarkable page with a form. The URL switches from the mounted one
into an unfriendly one.
Hi,
I have a simple page, with a form where the user may fill in their
e-mail and press the submit button.
I mount it in the init method of the class which implements
WebApplication using:
mountBookmarkablePage("forgotpassword", ForgotPassword.class);
It works and I'm able to access the page by visiting:
http://localhost:8080/app/forgotpassword
When the user fills in their email and presses submit the URL changes
into: http://localhost:8080/app/?wicket:interface=:6::::
My page code is: (or for a syntax highlighted version visit:
http://pastebin.com/f70c8ac47 )
public class ForgotPassword extends BasePage {
TextField email;
@SpringBean
ForgotPasswordRequestService forgotPasswordRequestService;
public ForgotPassword(final PageParameters parameters) {
super(parameters);
Form form = new Form("form") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit() {
System.out.println("### "+email.getModelObject());
email.setModelObject("");
}
};
email = new TextField("email", new Model(""));
form.add(email);
Button submit = new Button("submit");
form.add(submit);
add(form);
}
}
Ideally I would like the URL to be
http://localhost:8080/app/forgotpassword after the e-mail submission.
I still would like to have a message on the page after submit, stating
the the password request has been mailed to the user.
If I can't have my ideal this would be better than the current:
http://localhost:8080/app/forgotpassword/something . Where something
is ignored in the case some user bookmarks the page and visits it
without any active session.
Best regards, Kent
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bookmarkable page with a form. The URL switches from the
mounted one into an unfriendly one.
Posted by quinya <y....@ilocal.nl>.
I'm having a similar, but different problem.
I have a PasswordResetPage for reseting a user password.
I am using Spring Security and need to link to it from a login.jsp.
So in my WebApplication class I have:
mountBookmarkablePage(ConstantsCommon.PASSWORD_RESET_PATH,
PasswordResetPage.class);
And this allows me to link to the page from the login.jsp. It also allows me
to specify in my Spring security that this URL does not require
authentication.
<sec:intercept-url pattern="/wicket/passwordReset*" filters="none" />
So I get to my PasswordResetPage ok. But when I hit the "Ok" button on my
form, it submits to a URL like
"http://localhost:8080/myapp/wicket/?wicket:interface blah blah blah".
And then my Spring Security intercepts it and redirects back to the
login.jsp.
How can I get the form to submit to the nice URL?
I have tried:
form.add(new AttributeModifier("action", true, new
Model(ConstantsCommon.PASSWORD_RESET_CONTEXT)));
But that just re-displays the page.
--
View this message in context: http://www.nabble.com/Bookmarkable-page-with-a-form.-The-URL-switches-from-the-mounted-one--into-an-unfriendly-one.-tp23658727p25677674.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bookmarkable page with a form. The URL switches from the mounted
one into an unfriendly one.
Posted by Jeremy Thomerson <je...@wickettraining.com>.
add the message to the session and
setResponsePage(ForgotPassword.class); You may need to do
setRedirect(true);
--
Jeremy Thomerson
http://www.wickettraining.com
On Thu, May 21, 2009 at 2:04 PM, Kent Larsson <ke...@gmail.com> wrote:
> Hi,
>
> I have a simple page, with a form where the user may fill in their
> e-mail and press the submit button.
>
> I mount it in the init method of the class which implements
> WebApplication using:
>
> mountBookmarkablePage("forgotpassword", ForgotPassword.class);
>
> It works and I'm able to access the page by visiting:
> http://localhost:8080/app/forgotpassword
>
> When the user fills in their email and presses submit the URL changes
> into: http://localhost:8080/app/?wicket:interface=:6::::
>
> My page code is: (or for a syntax highlighted version visit:
> http://pastebin.com/f70c8ac47 )
>
> public class ForgotPassword extends BasePage {
> TextField email;
>
> @SpringBean
> ForgotPasswordRequestService forgotPasswordRequestService;
>
> public ForgotPassword(final PageParameters parameters) {
> super(parameters);
>
> Form form = new Form("form") {
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void onSubmit() {
> System.out.println("### "+email.getModelObject());
> email.setModelObject("");
> }
> };
>
> email = new TextField("email", new Model(""));
> form.add(email);
>
> Button submit = new Button("submit");
> form.add(submit);
>
> add(form);
> }
> }
>
> Ideally I would like the URL to be
> http://localhost:8080/app/forgotpassword after the e-mail submission.
>
> I still would like to have a message on the page after submit, stating
> the the password request has been mailed to the user.
>
> If I can't have my ideal this would be better than the current:
> http://localhost:8080/app/forgotpassword/something . Where something
> is ignored in the case some user bookmarks the page and visits it
> without any active session.
>
> Best regards, Kent
>
> ---------------------------------------------------------------------
> 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