SSH applicationContext.xml中不能找到setter的错误

myeclipse做的SSH,为什么applicationContext.xml中还显示不能找到setter的错误,我已经在service和action里添加了啊。app... myeclipse做的SSH,为什么applicationContext.xml中还显示不能找到setter的错误,我已经在service和action里添加了啊。

applicationContext.xml:

<!-- 修改 StudentsDAO引用sessionFactory,添加service 引用DAO ,添加action引用service-->
<bean id="IStudentsDAO" class="com.yourcompany.dao.StudentsDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="IStudentsService" class="com.yourcompany.service.StudentsService">
<property name="IStudentsDAO" ref="IStudentsDAO" >
</property>
</bean>
<bean id="InsertstudentAction" class="com.yourcompany.struts.action.InsertstudentAction">
<property name="IStudentsService" ref="IStudentsService" >
</property>
</bean>

</beans>

⑴StudentsService.java:
package com.yourcompany.service;

import com.yourcompany.dao.IStudentsDAO;
import com.yourcompany.po.Students;

public class StudentsService {

private IStudentsDAO istudentsdao;

public void insertstudents(Students s)
{
istudentsdao.save(s);
}
public Students getStudents(Integer id)
{
return istudentsdao.findById(id);

}

public IStudentsDAO getIstudentsdao() {
return istudentsdao;
}
public void setIstudentsdao(IStudentsDAO istudentsdao) {
this.istudentsdao = istudentsdao;
}
}
⑵InsertStudentAction.java:

public class InsertstudentAction extends DispatchAction {
/*
* Generated Methods
*/

/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
private IStudentsService istudentsservice;

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DynaActionForm insertstudentForm = (DynaActionForm) form;// TODO Auto-generated method stub

Integer id=(Integer) insertstudentForm.get("id");
String name=(String) insertstudentForm.get("name");
String age=(String) insertstudentForm.get("age");

Students s=new Students();
s.setId(id);
s.setName(name);
s.setAge(age);

Students stufromDB=istudentsservice.getStudents(id);
if(!id.equals(stufromDB))
{
istudentsservice.insertstudents(s);
return mapping.findForward("success");
}
else
return mapping.findForward("fail");

}

public IStudentsService getIstudentsservice() {
return istudentsservice;
}

public void setIstudentsservice(IStudentsService istudentsservice) {
this.istudentsservice = istudentsservice;
}

}
展开
 我来答
rockhb
2009-06-10 · TA获得超过344个赞
知道小有建树答主
回答量:312
采纳率:0%
帮助的人:171万
展开全部
你的javabean没有setXX这个方法才报这样的错误,看看ActionForm里的属性是不是都有set方法,还有,jsp上的Form里的世滚属性要对应搜拍余ActionForm上的属性;这个不是贺悉spring整合时的错误。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式