jsf页面运行报错
比谁都牛
2010-12-19
<h:form>
<h:panelGrid columns="2" columnClasses="course-modify-left,course-modify-right"> <h:outputText value="课程名"/><h:inputText value="#{addCourse.courseName}"></h:inputText> <h:outputText value="课程类别"/> <h:outputText value="开始时间"/> <rich:calendar popup="true" datePattern="yyyy-MM-dd" value="#{addCourse.courseBeginTime}"></rich:calendar> <h:outputText value="结束时间"/> <rich:calendar popup="true" datePattern="yyyy-MM-dd" value="#{addCourse.courseEndTime}"></rich:calendar> <h:outputText value="允许访客登录"/> <h:selectBooleanCheckbox value="#{addCourse.visited}"></h:selectBooleanCheckbox> <h:outputText value="课程描述" /><h:inputTextarea cols="30" rows="15" value="#{addCourse.courseDescription}"></h:inputTextarea> </h:panelGrid> <h:commandButton value="提交" styleClass="course-modify-button" action="#{addCourse.createCourse}"></h:commandButton> </h:form>后台代码: package cn.edu.xmu.cms.view.course; import java.util.Date; import cn.edu.xmu.cms.controller.ICourseManager; import cn.edu.xmu.cms.model.entities.course.Course; import cn.edu.xmu.cms.model.entities.course.CourseType; import cn.edu.xmu.cms.view.core.Constants; import cn.edu.xmu.cms.view.util.Utils; public class AddCourse { private int courseId; // 主码 private String courseName; // 课程名 private CourseType courseType; // 课程类别 private String courseDescription;// 课程介绍 private Date courseBeginTime; // 课程起始时间 private Date courseEndTime; // 课程结束时间 private boolean visited; // 对访客是否可见 private boolean opened; // 开课是否成功 private String csType; private ICourseManager iCourseManager; private Course course; AddCourse() { course = new Course(); } public Course getCourse() { return course; } public void setCourse(Course course) { this.course = course; } public String getCsType() { return csType; } public void setCsType(String csType) { this.csType = csType; } public int getCourseId() { return courseId; } public void setCourseId(int courseId) { this.courseId = courseId; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public CourseType getCourseType() { return courseType; } public void setCourseType(CourseType courseType) { this.courseType = courseType; } public String getCourseDescription() { return courseDescription; } public void setCourseDescription(String courseDescription) { this.courseDescription = courseDescription; } public Date getCourseBeginTime() { return courseBeginTime; } public void setCourseBeginTime(Date courseBeginTime) { this.courseBeginTime = courseBeginTime; } public Date getCourseEndTime() { return courseEndTime; } public void setCourseEndTime(Date courseEndTime) { this.courseEndTime = courseEndTime; } public boolean isVisited() { return visited; } public void setVisited(boolean visited) { this.visited = visited; } public boolean isOpened() { return opened; } public void setOpened(boolean opened) { this.opened = opened; } public ICourseManager getiCourseManager() { return iCourseManager; } public void setiCourseManager(ICourseManager iCourseManager) { this.iCourseManager = iCourseManager; } /** * 创建课程 */ public String createCourse() throws Exception { course.setCourseName(courseName); course.setCourseType(courseType); course.setCourseBeginTime(courseBeginTime); course.setCourseEndTime(courseEndTime); course.setCourseDescription(courseDescription); course.setOpened(opened); //System.out.print("++++++++++++addCourse+++++++++++++++++++"); iCourseManager = Utils.getICourseManager(); iCourseManager.addCourse(course); return Constants.ADD_COURSE_SUCCESS; } } Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /course/add.jsp][Class: javax.faces.component.html.HtmlForm,Id: j_id_jsp_158697453_42][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id_jsp_158697453_43]} Caused by: java.lang.IllegalAccessException - Class org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider can not access a member of class cn.edu.xmu.cms.view.course.AddCourse with modifiers "" |
|
比谁都牛
2010-12-19
请各位大神帮我看看问题出在哪?谢谢
|
|
lanzisun
2010-12-19
AddCourse 有没有在faces-config.xml里定义为manage bean呀?
|
|
比谁都牛
2010-12-20
有,但是还是会报错!
|
|
比谁都牛
2010-12-20
老是跳出像java.lang.IllegalAccessException - Class org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider can not access a member of class ...with modifiers "",这个不知道为什么
|
|
gardfield.vv
2010-12-20
public class IllegalAccessException
extends Exception 当应用程序试图创建一个实例(而不是数组)、设置或获取一个字段,或者调用一个方法,但当前正在执行的方法无法访问指定类、字段、方法或构造方法的定义时,抛出 IllegalAccessException。 在public String create...() 设个断点debug下... 配置文件也贴出来啊~ |
|
eclipse07
2010-12-20
AddCourse()
{ course = new Course(); } 改为 public 试试 还有 setiCourseManager 应该是 setICourseManager 吧 |
|
gardfield.vv
2010-12-20
eclipse07 写道 AddCourse()
{ course = new Course(); } 改为 public 试试 还有 setiCourseManager 应该是 setICourseManager 吧 好眼力~ |
|
hadeslee
2010-12-20
难道楼主的getter,setter不是程序生成的,是自己手打的?
|
|
lxs647
2010-12-24
这个就是手打程序的悲剧结果、、、、、、
|