SSH项目搭建-准备

SSH项目搭建

1.创建工程--tomcat

2.创建we/web-inf/lib文件夹,引入全部jar包

 

3.创建配置文件夹resource将配置文件放入

 

 4.建立相应的数据库,并修改jdbc.properties文件中的相关信息

5.开启注解功能

6.将前端页面放到web目录中

7.设置默认浏览器并开启热部署

8.配置核心过滤器,spring监听器,设置欢迎页面(web.xml文件)【固定写法】

<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
             version="4.0">

    <!--配置核心过滤器-->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- Spring的核心监听器 -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- 加载Spring的配置文件的路径的,默认加载的/WEB-INF/applicationContext.xml -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>

    <!--设置欢迎页 服务器一启动就会跳转的页面-->
    <welcome-file-list>
        <welcome-file>mgr_login.jsp</welcome-file>
    </welcome-file-list>
</web-app>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章