-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I want use mvc
public class FmisLogin extends SelectorComposer<Window> { @SuppressWarnings("unused") private final static Logger logger = Logger.getLogger(FmisLogin.class); private static final long serialVersionUID = -71422545405325060L; // @Wire // private Label lbl_ServerTime; @Wire private Textbox txtbox_Username, txtbox_Password; public FmisLogin() { super(); } @Override public void doAfterCompose(Window comp) throws Exception { super.doAfterCompose(comp); this.txtbox_Username.setValue("admin"); this.txtbox_Password.setValue("admin"); this.txtbox_Username.focus(); } @Listen("onClick=#btnReset") public void onReset(Event event) { this.txtbox_Username.setValue(""); this.txtbox_Password.setValue(""); this.txtbox_Username.focus(); } @Listen("onClick=#btnClosed") public void onClosed() throws IOException { Executions.sendRedirect("/j_spring_logout"); } }
change to mvvm set fucus txtbox_Username
public class LoginViewModel { private String username = "admin"; private String password = "admin"; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Command public void reset() { setUsername(""); setPassword(""); } @Command public void onClosed() { Executions.sendRedirect("/j_spring_logout"); } }
Asked: 2012-11-02 07:02:50 +0800
Seen: 61 times
Last updated: Nov 02 '12