In the Using Tags lesson, we implemented a Logon form. In the Coding Actions lesson, we interpret the Logon form, and return a different result code depending on the circumstances.
...
and enter a likely username and passowrdpassword. Since we haven't given the Action any behavior, the mapping redisplays the default Logon.jsp
page.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
package tutorial;
import com.opensymphony.xwork2.ActionSupport;
public class Logon extends ActionSupport {
public String execute() throws Exception {
if (isInvalid(getUsername())) return INPUT;
if (isInvalid(getPassword())) return INPUT;
return SUCCESS;
}
private boolean isInvalid(String value) {
return (value == null || value.length() == 0);
}
private String username;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
|
...
For more about Actions, see Architecture Big Picture in the Core Developers Guide.
Next | Onward to Selecting Results |
---|---|
Prev | Return to Hello World Using Tags |