⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loginaction.jad

📁 当下流行的struts2的一个简单应用
💻 JAD
字号:
// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov  Date: 2009-1-19 9:23:49
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   LoginAction.java

package com.jack.user.action;

import com.jack.user.model.IUserServices;
import com.jack.user.pojo.User;
import com.jack.user.pojo.UserInfor;
import java.io.PrintStream;
import java.util.*;
import org.apache.struts2.interceptor.SessionAware;

public class LoginAction
    implements SessionAware
{

    public LoginAction()
    {
    }

    public void setUserServices(IUserServices userServices)
    {
        this.userServices = userServices;
    }

    public void setUserName(String userName)
    {
        this.userName = userName;
    }

    public String getUserName()
    {
        return userName;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public String getPassword()
    {
        return password;
    }

    public String userLogin()
        throws Exception
    {
        String result = null;
        try
        {
            boolean flag = userServices.checkUser(getUserName(), getPassword());
            if(flag)
            {
                result = "success";
            } else
            {
                setTip("<font color='red'>\u5BF9\u4E0D\u8D77\u60A8\u7684\u5E10\u53F7\u6216\u5BC6\u7801\u6709\u8BEF\uFF01</font>");
                result = "noUser";
            }
        }
        catch(Exception e)
        {
            setTip("<font color='red'>\u5BF9\u4E0D\u8D77,\u7CFB\u7EDF\u51FA\u73B0\u6545\u969C\uFF0C\u8BF7\u7A0D\u540E\u518D\u767B\u5F55\uFF01</font>");
            e.printStackTrace();
            result = "noUser";
        }
        return result;
    }

    public String saveAccount()
    {
        String result = null;
        try
        {
            session.put("userName", getUserName());
            session.put("password", getPassword());
            result = "success";
        }
        catch(Exception e)
        {
            e.printStackTrace();
            result = "error";
        }
        return result;
    }

    public String userRegister()
    {
        String result = "";
        try
        {
            user = new User();
            String uname = (String)session.get("userName");
            String pwd = (String)session.get("password");
            user.setUserName(uname);
            user.setPassword(pwd);
            Set set = new HashSet();
            System.out.println((new StringBuilder("\u5F97\u5230\u7684\u771F\u5B9E\u59D3\u540D\uFF1A")).append(getName()).toString());
            UserInfor userInfor = new UserInfor();
            userInfor.setName(getName());
            userInfor.setEmail(getEmail());
            userInfor.setSex(getSex());
            userInfor.setAddress(getAddress());
            userInfor.setAge(Integer.valueOf(Integer.parseInt(getAge())));
            userInfor.setUser(user);
            set.add(userInfor);
            user.setUserInfors(set);
            userServices.saveUser(user);
            result = "success";
        }
        catch(Exception e)
        {
            setTip("\u7CFB\u7EDF\u51FA\u73B0\u6545\u969C!");
            result = "error";
            e.printStackTrace();
        }
        return result;
    }

    public User getUser()
    {
        return user;
    }

    public void setUser(User user)
    {
        this.user = user;
    }

    public String getTip()
    {
        return tip;
    }

    public void setTip(String tip)
    {
        this.tip = tip;
    }

    public void setSession(Map session)
    {
        this.session = session;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    public String getAge()
    {
        return age;
    }

    public void setAge(String age)
    {
        this.age = age;
    }

    public String getSex()
    {
        return sex;
    }

    public void setSex(String sex)
    {
        this.sex = sex;
    }

    public String getAddress()
    {
        return address;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }

    private User user;
    private String userName;
    private String password;
    private String name;
    private String email;
    private String age;
    private String sex;
    private String address;
    private String tip;
    private Map session;
    private IUserServices userServices;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -