1.直接在类中编写execute()方法:
public String execute() {
System.out.println("HelloWorld");
return "index";
}
2.让类实现Action接口:
@Override
public String execute() throws Exception {
System.out.println("HelloWorld");
return "index";
}
3.继承ActionSupport类
@Override
public String execute() throws Exception {
System.out.println("HelloWorld");
return "index";
}
ActionSupport类中提供了一些基本功能:
1.表单验证
2.国际化
让一个类继承了ActionSupport就能直接ActionSupport类中的表单验证、国际化等功能。