mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
Adds dedicated method to display Login form and base on declarative validation instead of on programmatic one
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1525512 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -21,19 +21,18 @@
|
||||
|
||||
package example;
|
||||
|
||||
import org.apache.struts2.interceptor.validation.SkipValidation;
|
||||
|
||||
public class Login extends ExampleSupport {
|
||||
|
||||
@Override
|
||||
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);
|
||||
@SkipValidation
|
||||
public String form() throws Exception {
|
||||
return INPUT;
|
||||
}
|
||||
|
||||
private String username;
|
||||
|
||||
Reference in New Issue
Block a user