
Сгенерированный военный файл:

Код: Выделить всё
pom.xml
Код: Выделить всё
4.0.0
com.manaar
Maven8a2
1.0-SNAPSHOT
war
Maven8a2
${project.build.directory}/endorsed
UTF-8
javax
javaee-web-api
6.0
provided
org.apache.struts
struts2-core
2.3.15.1
log4j
log4j
1.2.14
org.apache.maven.plugins
maven-compiler-plugin
2.3.2
1.6
1.6
${endorsed.dir}
org.apache.maven.plugins
maven-war-plugin
2.1.1
false
org.apache.maven.plugins
maven-dependency-plugin
2.1
validate
copy
${endorsed.dir}
true
javax
javaee-endorsed-api
6.0
jar
Код: Выделить всё
web/jsp/Required.jsp
Код: Выделить всё
required Validator Example
@import url(css/main.css);
.errorMessage {
color:red;
}
Enter user name and password
Код: Выделить всё
web/jsp/Thanks.jsp
Код: Выделить всё
Thank you
@import url(css/main.css);
Thank you
Код: Выделить всё
WEB-INF/classes/app08a/RequiredTestAction.class
Код: Выделить всё
package app08a;
import com.opensymphony.xwork2.ActionSupport;
public class RequiredTestAction extends ActionSupport {
private String userName;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
Код: Выделить всё
WEB-INF/classes/app08a/RequiredTestAction-validation.xml
Код: Выделить всё
Please enter a user name
Please enter a password
Код: Выделить всё
WEB-INF/classes/struts.xml
Код: Выделить всё
/jsp/Required.jsp
/jsp/Required.jsp
/jsp/Thanks.jsp
Код: Выделить всё
WEB-INF/web.xml
Код: Выделить всё
struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
struts2
/*
JSPs
/jsp/*
BASIC
При запуске этого приложения я вызываю Required1.action. Даже если я не ввожу пароль, он сразу переходит к Action2 и перехватчику проверки (
Код: Выделить всё
RequiredTestAction-validation.xml
Подробнее здесь: https://stackoverflow.com/questions/180 ... n-struts-2