日期:2014-05-20  浏览次数:20719 次

新手求解答,基于ssh怎么把从数据库获得的LIst<User>,显示在jsp的表单中。
action中的代码:
public String execute() {
String FORWARD="error";
System.out.println("调用execute方法");
try {
        User user=new User();
HttpServletRequest request=ServletActionContext.getRequest();
List<User> selectempinfo= userManagerService.managerUser(user);
        request.setAttribute("selectempinfo", selectempinfo);
if(selectempinfo!=null){
    FORWARD="success";
   }
但是报错了:Error creating bean with name 'managerAction' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userManagerService' of bean class [ccsu.action.UserManagerAction]: Bean property 'userManagerService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
我的理解:这个HttpServletRequest request=ServletActionContext.getRequest()方法和我的不兼容?求大神解答一下,怎么把数据库中的List<User>表单显示在jsp中。
java?ssh? JSP 数据库

------解决方案--------------------
看一下你的配置文件里得sessionfactory,是否出现下面问题
 <bean id="transactionManager"
          class="org.springframework.orm.hibernate3.HibernateTransactionManager">

查看
另外看一下是否缺少get/set方法