package com.action;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.bean.User;
import com.opensymphony.xwork2.ActionSupport;
/*
* 配置返回结果视图
*/
@Results({ @Result(name = "success", location = "/login.jsp"), @Result(name = "error", location = "/500.jsp") })
public class LoginAnnotations extends ActionSupport {
private User user;
/*
* 配置Action请求
*/
@Action(value = "/loginAnnotations")
public String login() {
if (user.getUsername() != null) {
return "success";
}
return "errro";
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}