第一次使用Strut的<html:multibox>标签库时,遇到了一个棘手问题:
org.apache.jasper.JasperException: No getter method available for property XXX for bean under name org.apache.struts.taglib.html.BEAN
经过了大半天痛苦的挣扎,才找到了这bug的根源。把我的这个问题写下来,希望对遇到的人有所帮助。- Step One:检查JSP和ActionFormBean中是否有拼写错误。
- Step Two:检查在request中修改了属性名为ActionFormBean的代码,看是否存入了错误的FormBean导致属性不匹配。
// in my JSP




// in my ActionFormA









// in my Action


错误在此!增加了ActionForm的propertyA属性但是存到request中的确是没有修改的HibernateBean!
修改后 :
HibernateBean hb = manager.getHibernateBean(id);
ActionFormA aForm = new ActionFormA(hb); //将hb数据复制到aForm中
httpServletRequest.setAttribute("ActionFormA", mForm );
ActionFormA aForm = new ActionFormA(hb); //将hb数据复制到aForm中
httpServletRequest.setAttribute("ActionFormA", mForm );
It works!
