首页>代码>jfinal+extjs4.2 实现的基于extjs mvc的通用后台管理系统>/ext_mvc/src_base/com/xybl/base/controller/LoginController.java
package com.xybl.base.controller;

import com.jfinal.core.Controller;
import com.xybl.base.model.SysUser;
import com.xybl.base.service.SysUserService;

public class LoginController extends Controller{
	public static final String KEY= "mykey";
	/**
	 * 登录
	 */
	public void login(){
		// 获取用户名
        String username = getPara("username");
        // 获取密码
        String password = getPara("password");
        SysUser user=SysUserService.service.login(username, password);
        if (user != null) {
        	System.out.println(user);
    		System.out.println(user.getStr("user_full_name"));
            // 保存session
            getSession().setAttribute("username", user.getStr("user_name"));
            getSession().setAttribute("curUser", user);
            setAttr("success", true);
        }else{
        	setAttr("success", false);
        }
        renderJson();
	}
	 //生成验证码
    public void imgcode() {
        //这个是jfinal自带的验证码生成类,可以直接使用的
        //CaptchaRender img = new CaptchaRender(KEY);
        //render(img);
    }
}
最近下载更多
akittyboy  LV9 4月16日
lironggang  LV38 2022年8月8日
wanglinddad  LV54 2022年4月18日
easyzzh  LV3 2021年11月5日
是斐不是飞  LV1 2021年10月7日
JAVA工程师123  LV3 2020年12月23日
e307911  LV7 2020年5月30日
8329wuming  LV1 2020年4月18日
a58807333  LV9 2020年4月2日
newnu88  LV12 2020年2月17日
最近浏览更多
akittyboy  LV9 4月16日
微信网友_6549826556514304  LV2 2023年7月6日
lhlhlhlh55 2023年6月13日
暂无贡献等级
暂无贡献等级
网约车源码 2022年12月31日
暂无贡献等级
cdjiangyang 2022年8月23日
暂无贡献等级
ttttt111 2022年6月24日
暂无贡献等级
子非鱼也  LV3 2022年5月7日
wanglinddad  LV54 2022年4月18日
不会写代码的小姚  LV3 2021年11月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友