package net.leon.travel.admin.module;
import javax.servlet.http.HttpSession;
import net.leon.travel.admin.bean.Administrator;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.Ok;
@IocBean
@At("/admin")
@Ok("json")
@Fail("http:500")
public class AdminEntrance extends BaseAdminModule{
/**
* 这里进入管理员登录页面的入口
*/
@Filters
@At("/entrance")
@Ok("admin.login")
@Fail("http:500")
public void entrance(String username,String password,HttpSession session){
}
/**
* 管理员登录
*/
@Filters
@At("/login")
@Ok("json")
public String login(String username,String password,HttpSession session){
Administrator admin=dao.fetch(Administrator.class,Cnd.where("username", "=", username).where(password, "=", password));
if (admin!=null) {
session.setAttribute("user", admin);
return "y";
}else{
return "n";
}
}
/**
* 管理员注销登录
*/
@At
@Ok("json")
public void logout(HttpSession session){
session.removeAttribute("user");
}
}
8 回复
2017-03-13 16:34:34,963 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:148) DEBUG - '/home/user/register' >> UserBO.register(...) : Map | @Ok(json ) @Fail(json ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-03-13 16:34:34,974 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:148) DEBUG - '/home/user/login' >> UserBO.login(...) : Map | @Ok(json ) @Fail(json ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-03-13 16:34:34,978 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:148) DEBUG - '/home/user/logout' >> UserBO.logout(...) : void | @Ok(json ) @Fail(json ) | by 1 Filters | (I:UTF-8/O:UTF-8)
2017-03-13 16:34:34,999 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:148) DEBUG - '/home/sights/getsights' >> SightsBO.getSights(...) : Map | @Ok(jsp:/hotel.jsp) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-03-13 16:34:35,005 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:148) DEBUG - '/admin/entrance' >> AdminEntrance.entrance(...) : void | @Ok(jsp:admin.login) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
2017-03-13 16:34:35,021 org.nutz.mvc.impl.UrlMappingImpl.print(UrlMappingImpl.java:148) DEBUG - '/home/', '/homehome' >> HomeBO.Home(...) : Map | @Ok(jsp:/index.jsp) @Fail(http:500) | by 0 Filters | (I:UTF-8/O:UTF-8)
问题在于可以启动的 完全正常,它自己添加了
添加回复
请先登陆