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>