package action;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpServletRequest;

public class syslogin extends ActionSupport {

    @Override
    public String execute() throws Exception {
        HttpServletRequest request= ServletActionContext.getRequest();
        String rq=request.getParameter("name");
        String pd=request.getParameter("pd");
        if (rq==null){
           addActionError("请输入用户名");
            return INPUT;
        }
        if (pd==null){
           addActionError("请输入密码");
            return INPUT;
        }

        if (!rq.equals("admin")){
           addActionError("用户不存在");
            return INPUT;
        }
        if (!pd.equals("123456")){
           addActionError("密码不正确");
            return INPUT;
        }
        request.getSession().putValue("login", "1");
        return SUCCESS;
    }
    public String logout(){
        HttpServletRequest request=ServletActionContext.getRequest();
        request.getSession().putValue("login", 0);
        return SUCCESS;
    }
}
最近下载更多
lizhenmrt  LV4 2022年12月12日
这不是一只柚子吗  LV6 2021年5月24日
feiyang991128  LV4 2021年5月12日
hao liong  LV2 2021年5月3日
wensidy  LV10 2021年4月27日
hahaman  LV5 2021年4月25日
lili010126  LV8 2021年4月2日
184773349  LV8 2021年3月6日
cxy2956  LV1 2021年1月10日
李晓晗  LV1 2021年1月7日
最近浏览更多
shunlun8855  LV1 2024年10月29日
FAST_98C4 2024年9月9日
暂无贡献等级
破剑茶寮  LV4 2024年6月26日
WBelong  LV8 2024年3月6日
asddwh  LV13 2023年12月29日
微信网友_6790506018131968  LV1 2023年12月23日
wkq888  LV17 2023年11月27日
958546428  LV3 2023年11月10日
mhymhy123  LV1 2023年10月20日
wbx666  LV1 2023年9月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友