利用MyEclipse内置架包搭建ssh框架详细步骤

ssh整合

我们一般在搭建框架的时候经常使用的是导入架包然后搭建项目,但是如果我们在没有架包的情况下怎么来搭建ssh框架呢

除开我们用别的框比如meavn搭建,但是不排除在没有网络的情况下我们也无法完整的搭建出来,那么现在我就教大家一种可以在没有网路的情况下搭建框架的步骤。

1、建库建表

2、新建web项目

3、添加spring支持

需要四个库(aop,core,persistence,web)可以这样记(前3个加web)

4、添加hibernate支持

使用默认的2个库,hibernate的操作采用默认操作

下面这一步不要默认,按图操作

5、修改hibernate.cfg.xml文件,设置自动提交

<property name="connection.autocommit">true</property>

<property name="show_sql">true</property>

           <property name="format_sql">true</property>

6、添加struts支持

这里需要两个库(core,spring)第一个和spring

7、解决包冲突问题

删除antlr-2.7.2.jar

找到窗口-首选项--myeclipse按图操作,先选定上面的这个包,单击remove,然后单击apply

8、修改web.xml文件

8.1设置监听器让spring框架首先启动

<listener>

  <listener-class>

  org.springframework.web.context.ContextLoaderListener

  </listener-class>

  </listener>

8.2配置applicationContext.xml的文件查找位置

这里需要死记

<context-param>

  <param-name>contextConfigLocation</param-name>

  <param-value>classpath:applicationContext.xml</param-value>

  </context-param>

9、利用hibernate反向工程生成实体类和映射文体

10、编写BaseDao

11、编写具体的dao继承自BaseDao并且交给spring管理

<bean id="stuDao" class="com.dao.StudentDao">

    <property name="sessionFactory" ref="sessionFactory"></property>

    <property name="entityName" value="com.entity.StudentInfo"></property>

  </bean>

12、编写BaseAction

13、编写具体的action并且交给spring管理

<bean id="stuAction" class="com.action.StudentAction">

  <property name="stuDao" ref="stuDao"></property>

  </bean>

14、配置struts.xml

15、编写index.jsp

16、部署运行

猜你喜欢

转载自blog.csdn.net/fengqing2501441998/article/details/82791132