package org.example.TSA504.pages;
import org.apache.tapestry.annotations.ApplicationState;
import org.apache.tapestry.annotations.Inject;
import org.example.TSA504.beans.TUser;
import org.example.TSA504.services.interfaces.UserAuthenticator;
/* BeanEditForm usage example from the ScreenCast#4 - http://tapestry.apache.org/tapestry5/screencast.html*/
public class Registration {
@ApplicationState
private TUser _addnew;
@Inject
private UserAuthenticator _authenticator;
/* @Component //for future...
private BeanEditForm _form;*/
String onSuccess() {
if (_addnew==null){ return null;}
if (!(_authenticator.addNewTUser(_addnew))){
//_form.recordError("Sorry, a error has occured upon adding the user"); // For some reason BeanEditForm hasn't recordError() (inspite of JavaDoc).
return null;
}
_addnew = null; //Destroying user data from "session"
return "Start";
}
/**
* @return the _addnewPage
*/
public TUser getAddnew() {
return _addnew;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment