You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by aabfattah <ah...@gmail.com> on 2011/09/19 12:32:43 UTC
setResponsePage is not working in SignInPanel
Hello ,
I have reused the code of the SignInPanel to make another class with Arabic
support then I added a button to signup for new user inside the sign in form
but this button doesn't work and doesn't throw any exceptions
*I made a system.println inside the button onSubmit() method and it prints
in console but it doesn't do a redirect .
*
//From SignInPanel.java
*/
public SignInForm(final String id) {
super(id);
setModel(new CompoundPropertyModel<SignInPanel>(SignInPanel.this));
// Attach textfields for username and password
add(new TextField<String>("username").setRequired(true));
add(new PasswordTextField("password").setRequired(true));
// MarkupContainer row for remember me checkbox
WebMarkupContainer rememberMeRow = new WebMarkupContainer(
"rememberMeRow");
add(rememberMeRow);
// Add rememberMe checkbox
rememberMeRow.add(new CheckBox("rememberMe"));
// Show remember me checkbox?
rememberMeRow.setVisible(includeRememberMe);
*//New User button*
*Button registerButton= new Button("register" )
{
public void onSubmit()
{
setResponsePage(AddNewCustomerPage.class);
System.out.println("New user button was pressed");
}
};
registerButton.setDefaultFormProcessing(false);
add(registerButton);*
}
/**
* @see org.apache.wicket.markup.html.form.Form#onSubmit()
*/
@Override
public final void onSubmit() {
IAuthenticationStrategy strategy = getApplication()
.getSecuritySettings().getAuthenticationStrategy();
if (signIn(getUsername(), getPassword())) {
//onSignInSucceeded();
User user = ((CallToFixWebSession) getSession()).getUser();
onSignInSucceededWithRedirect(user);
if (rememberMe == true) {
strategy.save(username, password);
} else {
strategy.remove();
}
} else {
onSignInFailed();
strategy.remove();
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setResponsePage-is-not-working-in-SignInPanel-tp3823554p3823554.html
Sent from the Users forum 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: setResponsePage is not working in SignInPanel
Posted by aabfattah <ah...@gmail.com>.
To be more precise :
A post is done .
Then a get request to the page I want.
*Then a get request to the homepage again .
*
How can I solve this ?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setResponsePage-is-not-working-in-SignInPanel-tp3823554p3823589.html
Sent from the Users forum 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: setResponsePage is not working in SignInPanel
Posted by aabfattah <ah...@gmail.com>.
That's what I get
[12:48:22.393] GET
http://localhost:8080/;jsessionid=oaz5usmzhnl1a5ixlhs4ilb8 [HTTP/1.1 200 OK
5ms]
[12:48:22.387] GET
http://localhost:8080/wicket/bookmarkable/com.orange.cairolab.sdp.calltofix.web.customer.AddNewCustomerPage
[HTTP/1.1 302 Found 3ms]
[12:48:22.357] POST
http://localhost:8080/?0-1.IFormSubmitListener-signInPanel-signInForm
[HTTP/1.1 302 Found 8ms]
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setResponsePage-is-not-working-in-SignInPanel-tp3823554p3823583.html
Sent from the Users forum 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: setResponsePage is not working in SignInPanel
Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Sep 19, 2011 at 1:32 PM, aabfattah
<ah...@gmail.com> wrote:
> Hello ,
> I have reused the code of the SignInPanel to make another class with Arabic
> support then I added a button to signup for new user inside the sign in form
> but this button doesn't work and doesn't throw any exceptions
>
> *I made a system.println inside the button onSubmit() method and it prints
> in console but it doesn't do a redirect .
I guess it does redirect but then the authentication check makes
another redirect to the login page.
Check Firebug's logs in Net tab.
> *
> //From SignInPanel.java
>
> */
> public SignInForm(final String id) {
> super(id);
>
> setModel(new CompoundPropertyModel<SignInPanel>(SignInPanel.this));
>
> // Attach textfields for username and password
> add(new TextField<String>("username").setRequired(true));
> add(new PasswordTextField("password").setRequired(true));
>
> // MarkupContainer row for remember me checkbox
> WebMarkupContainer rememberMeRow = new WebMarkupContainer(
> "rememberMeRow");
> add(rememberMeRow);
>
> // Add rememberMe checkbox
> rememberMeRow.add(new CheckBox("rememberMe"));
>
> // Show remember me checkbox?
> rememberMeRow.setVisible(includeRememberMe);
>
> *//New User button*
>
> *Button registerButton= new Button("register" )
> {
> public void onSubmit()
> {
>
> setResponsePage(AddNewCustomerPage.class);
> System.out.println("New user button was pressed");
> }
> };
> registerButton.setDefaultFormProcessing(false);
> add(registerButton);*
> }
>
> /**
> * @see org.apache.wicket.markup.html.form.Form#onSubmit()
> */
> @Override
> public final void onSubmit() {
> IAuthenticationStrategy strategy = getApplication()
> .getSecuritySettings().getAuthenticationStrategy();
>
> if (signIn(getUsername(), getPassword())) {
> //onSignInSucceeded();
> User user = ((CallToFixWebSession) getSession()).getUser();
> onSignInSucceededWithRedirect(user);
>
> if (rememberMe == true) {
> strategy.save(username, password);
> } else {
> strategy.remove();
> }
> } else {
> onSignInFailed();
> strategy.remove();
> }
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/setResponsePage-is-not-working-in-SignInPanel-tp3823554p3823554.html
> Sent from the Users forum 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
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com