|
|
|
@ -1,3 +1,61 @@
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
package controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.Writer;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
|
|
import service.LoginService;
|
|
|
|
|
import domain.UserPO;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
public class LoginController {
|
|
|
|
|
@Autowired@Qualifier("LoginServiceImpl")
|
|
|
|
|
private LoginService loginService;
|
|
|
|
|
@RequestMapping("/login")
|
|
|
|
|
public void login(int s_id, int s_password,
|
|
|
|
|
HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
|
|
|
UserPO userPO=this.loginService.FindByUserid(s_id);
|
|
|
|
|
response.setContentType("text/html;charset=utf-8");
|
|
|
|
|
/* 设置响应头允许ajax跨域访问 */
|
|
|
|
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
|
|
|
|
/* 星号表示所有的异域请求都可以接受, */
|
|
|
|
|
response.setHeader("Access-Control-Allow-Methods", "GET,POST");
|
|
|
|
|
System.out.println(s_id);
|
|
|
|
|
if(userPO!=null)
|
|
|
|
|
if(s_password==userPO.getUserpassword())
|
|
|
|
|
{
|
|
|
|
|
System.out.println("密码正确");
|
|
|
|
|
Writer out = response.getWriter();
|
|
|
|
|
out.write("111");
|
|
|
|
|
out.flush();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
System.out.println("密码错误");
|
|
|
|
|
Writer out = response.getWriter();
|
|
|
|
|
out.write("100");
|
|
|
|
|
out.flush();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
System.out.println("不存在用户名");
|
|
|
|
|
Writer out = response.getWriter();
|
|
|
|
|
out.write("001");
|
|
|
|
|
out.flush();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
=======
|
|
|
|
|
package controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -54,3 +112,4 @@ public class LoginController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
>>>>>>> 0877d8ad681d47bc72cd343cd73f8dfb7321c3b6
|
|
|
|
|