解决方案 »

  1.   

    没有任何反映,下面的输出语句没有执行,也单步调试过了,HibernateTemplate是有对象的,执行find方法所在行的时候出现这个东西
      

  2.   

    User对象的属性跟hibernate中的配置文件看看。是不是别名,字段名称错了,不对应什么的
      

  3.   

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans.xsd">  <bean id="user" class="shopping.entity.User" scope="singleton"/>
      <bean id="userAction" class="shopping.action.UserAction">
       <property name="userService" ref="userService"/>
       <property name="user" ref="user"></property>
      </bean>
      
      <bean id="userService" class="shopping.serviceImpl.UserServiceImpl">
       <property name="userDao">
       <ref bean="userDao"/><!-- 指向其他配置文件下的bean -->
       </property>
      </bean>
      
    </beans>
      

  4.   

    找到错误的原因了,是因为struts反射获取action中的方法时抛出了一个InvocationTargetException异常,就是下面这个login方法,但是不知道该怎么解决
    package shopping.action;import shopping.entity.User;
    import shopping.service.UserService;
    import shopping.util.UserUtil;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport{ private UserService us;
    private User user;
    private String tip;//用于封装处理结果,可在下个页面获取

    public String login(){
    int reval = us.validate(user.getUsername(), user.getPassword());
    if(reval==1){
    return "success";
    }else{
    return "fail";
    }
    }
    public String regist(){
    user.setMemNum(UserUtil.autoProduceMemNum());
    user.setPoint(0);
    user.setIsenable(0);
    us.addUser(user);
    return "input";
    }

    public String getTip() {
    return tip;
    }
    public void setTip(String tip) {
    this.tip = tip;
    }
    public void setUs(UserService us) {
    this.us = us;
    }
    public UserService getUs() {
    return us;
    }
    public void setUserService(UserService us) {
    this.us = us;
    }
    public User getUser() {
    return user;
    }
    public void setUser(User user) {
    this.user = user;
    }
    }
      

  5.   

    http://blog.csdn.net/luoduyu/article/details/1443895
    来这里看看,也许对你有帮助
      

  6.   

    不是应改 SELECT * FROM User的吗