JSP+struts+hibernate开发在线考试管理系统时出错,请高手帮忙!!!
现在程序能进入运行界面,当相应的用户进入各用户功能界面后,进行下一步的功能操作时出错下面的错误:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Couldn't find the role!
cn.hxex.exam.filter.HibernateFilter.doFilter(HibernateFilter.java:71)
root cause
cn.hxex.exam.exception.ExamSystemException: Couldn't find the role!
cn.hxex.exam.struts.HxexRequestProcessor.processRoles(HxexRequestProcessor.java:96)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:197)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
cn.hxex.exam.filter.HibernateFilter.doFilter(HibernateFilter.java:49)
请问各位高手出错的原因是什么原因,是不是因为创建的数据表出错的原因!!
[解决办法]
是因为你没有在配置文件中给这个角色赋权限.
在你的.XML配置文件中,有一个ACTION方法没有注册这个方法权限吧
cn.hxex.exam.filter.HibernateFilter.doFilter(HibernateFilter.java:71)
在这个方法里,是你们自己封装了.没有给这些用户权限.所以都进不去
[解决办法]
最好把代码格式一下
<action-mappings> <action path="/manage/classes" type="cn.hxex.exam.action.ClassesAction" name="classesForm" scope="request" input="/manage/classes_add.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/manage/classes_add.jsp" redirect="false" /> <forward name="list" path="/manage/classes_list.jsp" redirect="false" /> <forward name="update" path="/manage/classes_update.jsp" redirect="false" /> <forward name="classes_teacher" path="/manage/classes_teacher.jsp" redirect="false" /> </action> <action path="/manage/student" type="cn.hxex.exam.action.StudentAction" name="studentForm" scope="request" input="/manage/student_add.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/manage/student_add.jsp" redirect="false" /> <forward name="update" path="/manage/student_update.jsp" redirect="false" /> <forward name="list" path="/manage/student_list.jsp" redirect="false" /> </action> <action path="/exam/testpaper" type="cn.hxex.exam.action.TestPaperAction" name="testPaperForm" scope="request" input="/exam/testpaper_list.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/exam/testpaper_add.jsp" redirect="false" /> <forward name="list" path="/exam/testpaper_list.jsp" redirect="false" /> <forward name="update" path="/exam/testpaper_update.jsp" redirect="false" /> <forward name="stulist" path="/exam/testpaper_stulist.jsp" redirect="false" /> <forward name="result" path="/exam/testpaper_result.jsp" redirect="false" /> </action> <action path="/exam/yesnoquestion" type="cn.hxex.exam.action.YesNoQuestionAction" name="yesnoQuestionForm" scope="request" input="/exam/question_list.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/exam/yesnoquestion_add.jsp" redirect="false" /> <forward name="update" path="/exam/yesnoquestion_update.jsp" redirect="false" /> <forward name="list" path="/exam/question_list.jsp" redirect="false" /> <forward name="exam" path="/exam/question_exam.jsp" redirect="false" /> </action> <action path="/exam/question" type="cn.hxex.exam.action.YesNoQuestionAction" name="questionForm" scope="request" input="/exam/question_list.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/exam/yesnoquestion_add.jsp" redirect="false" /> <forward name="update" path="/exam/yesnoquestion_update.jsp" redirect="false" /> <forward name="list" path="/exam/question_list.jsp" redirect="false" /> <forward name="exam" path="/exam/question_exam.jsp" redirect="false" /> </action> <action path="/manage/teacher" type="cn.hxex.exam.action.TeacherAction" name="teacherForm" scope="request" input="/manage/teacher_add.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/manage/teacher_add.jsp" redirect="false" /> <forward name="update" path="/manage/teacher_update.jsp" redirect="false" /> <forward name="list" path="/manage/teacher_list.jsp" redirect="false" /> <forward name="classes" path="/manage/teacher_classes.jsp" redirect="false" /> </action> <action path="/exam/question" type="cn.hxex.exam.action.QuestionAction" name="questionForm" scope="request" input="/exam/question_list.jsp" parameter="p" unknown="false" validate="false" > <forward name="list" path="/exam/question_list.jsp" redirect="false" /> <forward name="exam" path="/exam/question_exam.jsp" redirect="false" /> </action> <action path="/logon" type="cn.hxex.exam.action.LogonAction" name="userForm" scope="request" input="/logon.jsp" roles="unspecified,logon" parameter="p" unknown="false" validate="false" > <forward name="admin" path="/admin.jsp" redirect="false" /> <forward name="student" path="/student.jsp" redirect="false" /> <forward name="teacher" path="/teacher.jsp" redirect="false" /> <forward name="password" path="/manage/password.jsp" redirect="false" /> </action> <action path="/exam/selectquestion" type="cn.hxex.exam.action.SelectQuestionAction" name="selectQuestionForm" scope="request" input="/exam/question_list.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/exam/selectquestion_add.jsp" redirect="false" /> <forward name="list" path="/exam/question_list.jsp" redirect="false" /> <forward name="update" path="/exam/selectquestion_update.jsp" redirect="false" /> <forward name="list" path="/exam/question_list.jsp" redirect="false" /> <forward name="exam" path="/exam/question_exam.jsp" redirect="false" /> </action> <action path="/exam/question" type="cn.hxex.exam.action.SelectQuestionAction" name="questionForm" scope="request" input="/exam/question_list.jsp" parameter="p" unknown="false" validate="false" > <forward name="add" path="/exam/selectquestion_add.jsp" redirect="false" /> <forward name="list" path="/exam/question_list.jsp" redirect="false" /> <forward name="update" path="/exam/selectquestion_update.jsp" redirect="false" /> <forward name="list" path="/exam/question_list.jsp" redirect="false" /> <forward name="exam" path="/exam/question_exam.jsp" redirect="false" /> </action> <!-- If you have non XDoclet actions, define them in a file called struts-actions.xml and place it in your merge directory. --></action-mappings>
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html