zoukankan      html  css  js  c++  java
  • Java高级架构师(一)第25节:实现前端的业务登录等功能

    package com.sishuok.architecture1;
    
    import javax.servlet.http.Cookie;
    import javax.servlet.http.HttpServletResponse;
    
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.RequestParam;
    
    import com.sishuok.architecture1.customermgr.service.ICustomerService;
    import com.sishuok.architecture1.customermgr.vo.CustomerModel;
    
    @Controller
    @RequestMapping("/")
    public class LoginController {
    	@Autowired
    	private ICustomerService ics = null;
    	
    	@RequestMapping(value="/toLogin",method=RequestMethod.GET)
    	public String toLogin(){
    		return "login";
    	}
    	@RequestMapping(value="/login",method=RequestMethod.POST)
    	public String login(@RequestParam("customerId")String customerId
    			,@RequestParam("pwd")String pwd,HttpServletResponse response){
    		
    		if(customerId==null || customerId.trim().length()==0){
    			return "login";
    		}
    		ics.getByUuid(1);
    		CustomerModel cm = ics.getByCustomerId(customerId);
    		
    		if(cm==null || cm.getUuid()<=0){
    			return "login";
    		}
    		
    		Cookie c = new Cookie("MyLogin",cm.getUuid()+","+System.currentTimeMillis());
    		response.addCookie(c);
    		
    		return "redirect:/toIndex";
    	}
    }
    

    主要是关于登录界面的Java代码

  • 相关阅读:
    多点触摸时代来了,第一个是什么呢
    能看出点幻影刺客的风采
    XNA 贴图载入的新状况
    WAR3的模型,幻影刺客,我来了。
    幻影刺客跑起来啦
    TM2T入手
    哥们儿,你终于来了….哈哈,等的花儿都谢了。
    鸣谢 MAGOSX.com
    彩色版幻影刺客留念
    好吧,效果先到这里吧
  • 原文地址:https://www.cnblogs.com/sunrunzhi/p/10144639.html
Copyright © 2011-2022 走看看