一问:
我 打算 建 3个 用户 ,管理员 教师 学生 ;用同一个登录页面 怎么实现跳转 ?
表是这样建的 :id username password typeid nickname
0 ad1 123 0 sss
1 t1 124 1 ddd
2 s1 125 2 uuu
用的是struts1.2 hibernate3.1
登录界面是: 用户名:
密码:
用户类型:
包是这样建的: com.teach.hibernate
com.teach.hibernate.beans
com.teach.hibernate.dao
com.teach.hibernate.dao.util
com.teach.struts.actions
com.teach.struts.forms
com.teach.struts.resources
action 里调用DAO
我 打算 建 3个 用户 ,管理员 教师 学生 ;用同一个登录页面 怎么实现跳转 ?
表是这样建的 :id username password typeid nickname
0 ad1 123 0 sss
1 t1 124 1 ddd
2 s1 125 2 uuu
用的是struts1.2 hibernate3.1
登录界面是: 用户名:
密码:
用户类型:
包是这样建的: com.teach.hibernate
com.teach.hibernate.beans
com.teach.hibernate.dao
com.teach.hibernate.dao.util
com.teach.struts.actions
com.teach.struts.forms
com.teach.struts.resources
action 里调用DAO
问题: DAO userDAO 怎么设计?
问题: hibernate 查询DAO可以不用事务吧,能否给出代码
第二,关于跳转页面的设计 如果用到了权限管理 统一写rolemapping的类 对当前用户的可见function进行查询并在页面显示,当然这个function的操作权限 最好也要进行持久化保存和维护
第三,hibernate的事务为什么打不开 session。begintran。。方法不就是创建一个事务代码块吗
第四,dao类里就是定义和数据库有关的操作方法 比如 getuser,repassword等方法 然后在实现类里调用hibernate进行操作
第五,查询类的方法不涉及到数据的唯一性和完整性之类的东西,事务是不需要的
经验不足,等高手
而却 action 直接调dao,为什么没有业务层?
如果要 也该是选择的登陆成功 放入session中 到另外的 jsp页面 直接el表达式 加C:if标签啊
<c:if test="${user.typeid==0}">
管理员
</c:if>
<c:if test="${user.typeid==1}">
教师
</c:if>
<c:if test="${user.typeid==2}">
学生
</c:if>
可以在登陆的时候 取出角色类型 然后根据类型判断 跳转到指定的页面
这个在配置文件中配置 result不就可以了啊。不同的角色跳转到不同页面啊