You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by vdelanno <vi...@gmail.com> on 2011/03/06 19:27:02 UTC
null property
Hi all,
I'm new to Tapestry, and I have a problem with a simple Login form. When in
the OnSubmit callback of the form, the login and pasword fields are empty.
Could someone help me at least understand why?
Here is my loginForm class:
public class LoginForm {
@Persist(PersistenceConstants.FLASH)
private String loginMessage;
@Property
private String loginEmail;
@Property
private String loginPassword;
@Component
private Form loginForm;
@Inject
private Authenticator authenticator;
public Object onActionFromLoginForm() {
try {
authenticator.login(loginEmail, loginPassword);
return Index.class;
} catch (AuthenticationException ex) {
setLoginMessage("Invalid user name or password.");
}
return null;
}
public void setLoginMessage(String loginMessage)
{
this.loginMessage = loginMessage;
}
public String getLoginMessage() {
if (loginMessage != null) {
return loginMessage;
} else {
return " ";
}
}
}
here is the loginForm template
${loginMessage}
--
View this message in context: http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411636.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: null property
Posted by vdelanno <vi...@gmail.com>.
Sorry for double posting. But this time, the formatting should be ok
Hi all,
I'm new to Tapestry, and I have a problem with a simple Login form. When in
the OnSubmit callback of the form, the login and pasword fields are empty.
Could someone help me at least understand why?
Here is my loginForm class:
vdelanno wrote:
>
>
> public class LoginForm {
>
> @Persist(PersistenceConstants.FLASH)
> private String loginMessage;
>
> @Property
> private String loginEmail;
>
> @Property
> private String loginPassword;
>
> @Component
> private Form loginForm;
>
> @Inject
> private Authenticator authenticator;
>
>
> public Object onActionFromLoginForm() {
> try {
> authenticator.login(loginEmail, loginPassword);
> return Index.class;
> } catch (AuthenticationException ex) {
> setLoginMessage("Invalid user name or password.");
> }
> return null;
>
> }
>
> public void setLoginMessage(String loginMessage)
> {
> this.loginMessage = loginMessage;
> }
>
> public String getLoginMessage() {
> if (loginMessage != null) {
> return loginMessage;
> } else {
> return " ";
> }
> }
>
> }
>
here is the loginForm template
vdelanno wrote:
>
>
>
>
>
> ${loginMessage}
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
--
View this message in context: http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411646.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
Re: null property
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sun, 06 Mar 2011 17:04:02 -0300, vdelanno <vi...@gmail.com>
wrote:
> Thqnks for the reply
> But I donùt want them to be available accross pages, just from the Form
> submit handler.
@Persist doesn't make values available accross pages.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: null property
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sun, 06 Mar 2011 20:39:20 -0300, vdelanno <vi...@gmail.com>
wrote:
> Even if email is Annotated with persist, the value in the onSuccess is
> null.
> But the value is effectively stored for the next display.
> I don't expect to have to store the password with a Persist annotation
> anyway.
How are you checking if the fields are null? Debugging doesn't always show
the current field values due to the way Tapestry transforms page and
component classes. This will be fixed when not in production mode in T5.3.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: null property
Posted by vdelanno <vi...@gmail.com>.
Even if email is Annotated with persist, the value in the onSuccess is null.
But the value is effectively stored for the next display.
I don't expect to have to store the password with a Persist annotation
anyway. Even if I copy paste this page:
http://tapestry.apache.org/input-validation.html
I have the same problem. Would somebody have a solution?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411824.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: null property
Posted by Josh Canfield <jo...@gmail.com>.
Look at the docs for form. You don't want to catch action, you probably
want success or validate
On Mar 6, 2011 12:04 PM, "vdelanno" <vi...@gmail.com> wrote:
> Thqnks for the reply
> But I donùt want them to be available accross pages, just from the Form
> submit handler. RIght now, in the onActionFromLoginForm, loginPassword and
> loginEmail are null, whatever the value I enter in the input.
> Am I wrong? I shouldnùt have to persist the values just to use them in the
> submit handler
>
> --
> View this message in context:
http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411708.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
Re: null property
Posted by vdelanno <vi...@gmail.com>.
Thqnks for the reply
But I donùt want them to be available accross pages, just from the Form
submit handler. RIght now, in the onActionFromLoginForm, loginPassword and
loginEmail are null, whatever the value I enter in the input.
Am I wrong? I shouldnùt have to persist the values just to use them in the
submit handler
--
View this message in context: http://tapestry.1045711.n5.nabble.com/null-property-tp3411636p3411708.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: null property
Posted by Josh Kamau <jo...@gmail.com>.
Hi
If you want the values to be retained accross pages , Use @Persist
annotation on the pages
@Property
@Persist
private String loginEmail;
@Property
@Persist
private String loginPassword;
kind regards.