ITPub博客

首页 > IT职业 > IT生活 > SSH员工管理系统框架整合的源代码(大家帮我查一下哪里有问题,总是报错

SSH员工管理系统框架整合的源代码(大家帮我查一下哪里有问题,总是报错

IT生活 作者:rainbows 时间:2021-09-09 08:58:04 0 删除 编辑

applicationContext.xml 文件


    <!-- 引入外部属性文件 -->
    <!--配置连接池  --><!--配置hibernate相关属性  --><!--注入连接池  --><!-- 配置hibernate的属性 --> org.hibernate.dialect.MySQLDialect<!--  org.hibernate.dialect.Oracle10gDialect
 -->truetrueupdate<!-- 

 -->cn/mooc/daoMain/Product.hbml.xml<!-- 配置action类 --><!-- 配置业务层的类 --><!-- 配置dao层的类 --><!--配置事物管理 工具类  --><!-- 开启注解事物 -->

struts2文件

//商品action
public class ProductAction extends ActionSupport implements
        ModelDriven {
    // 模型驱动的类
    private Product product =new Product();
    public Product getModel() {
        // TODO Auto-generated method stub
        return product;
    }
    // strtus和spring 整合过程按名称自动注入的业务层类
    private ProductService productService;
    public ProductService getProductService() {
        return productService;
    }
    public void setProductService(ProductService productService) {
        this.productService = productService;
    }
    public String save() {
        System.out.println("action中的save方法执行了");
        productService.save(product);
        return NONE;
    }
}
//商品dao层
public class ProductDao extends HibernateDaoSupport {

    public void save(Product product) {
        System.out.println("dao中的save方法");
        HibernateTemplate hibernTemplate=   this.getHibernateTemplate();

        hibernTemplate.save(product);
    }

}

映射文件:


//商品业务层注入dao的类
@Transactional
public class ProductService {

    // 业务层注入dao的类
    private ProductDao productDao;

    public ProductDao getProductDao() {
        return productDao;
    }

    public void setProductDao(ProductDao productDao) {
        this.productDao = productDao;
    }

    public void save(Product product) {
        System.out.println("service中的save方法");
        productDao.save(product);
    }

}

jsp文件:

 

保存商品

商品名称
商品价格

报错提示:

六个报错,求救

第一1.7jdk

信息: validateJarFile(E:Tomcat7webappssshWEB-INFlibjavax.servlet-3.1.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
第二:”那个文档

ERROR - Error parsing XML: XML InputStream(5) 文档中根元素前面的标记必须格式正确。
Error on line 5 of document : 文档中根元素前面的标记必须格式正确。 Nested exception: 文档中根元素前面的标记必须格式正确。
第三,好多人都出了这个问题。但是没有能解决的。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
第四:
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

第五

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
第六:

严重: Error listenerStart

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2442/viewspace-2798348/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-15

  • 博文量
    112
  • 访问量
    1270