1.直接普通的java类进行开发,只需要编写一个execute的方法,在这个方法里具有一个String的返回值
public class LoginAction{
public String execute() {
return "success";
}
}
2.继承自Action接口的开发
public class LoginAction implements Action{
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return null;
}
}
3.继承自ActionSupport(推荐使用开发方式),并且ActionSupport是在struts中如果没有配置相应的action类,那么struts2默认就会调用这个ActionSupport这个类去处理。
public class LoginAction extends ActionSupport{
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return null;
}
}