亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Maven+oracle+SSM搭建簡(jiǎn)單項(xiàng)目的方法

 更新時(shí)間:2018年03月12日 14:35:58   作者:筱月  
本篇文章主要介紹了Maven+oracle+SSM搭建簡(jiǎn)單項(xiàng)目的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧

簡(jiǎn)單談一下maven搭建 ssm 項(xiàng)目 (使用數(shù)據(jù)庫(kù)oracle,比 mysql 麻煩一點(diǎn),所以這里談一下)

在創(chuàng)建maven 的web項(xiàng)目時(shí),常常會(huì)缺了main/java , main/test 兩個(gè)文件夾。

解決方法:

① : 在項(xiàng)目上右鍵選擇properties,然后點(diǎn)擊java build path,在Librarys下,編輯JRE System Library,選擇workspace default jre就可以了。 (推薦使用這種)

② :手動(dòng)創(chuàng)建 目錄。切換視圖采用Navigator視圖,直接在src/main目錄下建立 Java目錄。

項(xiàng)目目錄結(jié)構(gòu):

重要的配置文件:

對(duì)象模型配置文件: pom.xml

Spring的配置文件:applicationContext.xml

spring MVC配置文件: springmvc.xml

數(shù)據(jù)庫(kù)配置文件: jdbc.properties

日志配置文件: log4j.properties

mybatis配置文件: mybatis-config.xml

網(wǎng)絡(luò)程序配置文件:web.xml

首先配置pom.xml

pom.xml 主要描述了項(xiàng)目的maven坐標(biāo),依賴關(guān)系,自動(dòng)引入jar包

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.krry</groupId>
 <artifactId>maven_SSM</artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <name>maven_SSM</name>
 <url>http://maven.apache.org</url>

 <dependencies>
  <!--引入junit -->
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.11</version>
   <scope>test</scope>
  </dependency>
  <!--引入servlet -->
  <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>servlet-api</artifactId>
   <version>3.0-alpha-1</version>
   <scope>provided</scope>
  </dependency>
  <!--引入jstl的包 -->
  <dependency>
   <groupId>jstl</groupId>
   <artifactId>jstl</artifactId>
   <version>1.2</version>
   <scope>provided</scope>
   </dependency>
   
   <!--引入jsp的編譯依賴 -->
   <dependency>
   <groupId>javax.servlet.jsp</groupId>
   <artifactId>jsp-api</artifactId>
   <version>2.2</version>
   <scope>provided</scope>
   </dependency>
   
   <!--引入log4j -->
   <dependency>
   <groupId>log4j</groupId>
   <artifactId>log4j</artifactId>
   <version>1.2.17</version>
   </dependency>
   
   <!--spring springmvc mybatis -->
   <!-- spring和springmvc相關(guān)的構(gòu)建 jar --> 
   <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-context</artifactId>
   <version>4.2.1.RELEASE</version>
   </dependency>
   
   <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-jdbc</artifactId>
   <version>4.2.1.RELEASE</version>
   </dependency>
    
   <!-- springmvc相關(guān) -->
   <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-webmvc</artifactId>
   <version>4.2.1.RELEASE</version>
   </dependency>
   
   <!--springmvc需要用到j(luò)son的轉(zhuǎn)換包 jackson -->
   <dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-core</artifactId>
   <version>2.5.4</version>
   </dependency>
   
   <dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-annotations</artifactId>
   <version>2.5.4</version>
   </dependency>
   
   <dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-databind</artifactId>
   <version>2.5.4</version>
   </dependency>
   
   <!--JSR303 后臺(tái)校驗(yàn) hibernate validator -->  
   <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-validator</artifactId>
   <version>5.1.1.Final</version>
   </dependency>
   
   <!--上傳文件相關(guān)的jar包 -->
   <dependency>
   <groupId>commons-io</groupId>
   <artifactId>commons-io</artifactId>
   <version>2.4</version>
   </dependency>
   
   <dependency>
   <groupId>commons-fileupload</groupId>
   <artifactId>commons-fileupload</artifactId>
   <version>1.3.1</version>
   </dependency>
   
   <dependency>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-lang3</artifactId>
   <version>3.3.2</version>
   </dependency>
   
   <!--跟加密算法相關(guān)的codeC -->
  <dependency>
   <groupId>commons-codec</groupId>
   <artifactId>commons-codec</artifactId>
   <version>1.9</version>
  </dependency>
   
   <!--orm或者jdbc組件需要用到的jar包 mybatis -->
  <!--oracle數(shù)據(jù)庫(kù)驅(qū)動(dòng) -->
  <dependency>
   <groupId>com.oracle</groupId> 
   <artifactId>ojdbc6</artifactId> 
   <version>12.1.0.2.0</version>
  </dependency>
  <!--mysql數(shù)據(jù)庫(kù)驅(qū)動(dòng) (這里不用,用的是上面的oracle驅(qū)動(dòng)) -->
  <!-- 
  <dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>5.0.8</version>
   <scope>runtime</scope>
  </dependency>
  -->
  
  <!-- proxool連接池 -->
  <dependency>
   <groupId>com.cloudhopper.proxool</groupId>
   <artifactId>proxool</artifactId>
   <version>0.9.1</version>
  </dependency>
  <dependency>
   <groupId>com.cloudhopper.proxool</groupId>
   <artifactId>proxool-cglib</artifactId>
   <version>0.9.1</version>
  </dependency>


   <!--引入mybatis需要的jar包 -->
   <dependency>
   <groupId>org.mybatis</groupId>
   <artifactId>mybatis</artifactId>
   <version>3.3.1</version>
  </dependency>
  
  <dependency>
   <groupId>org.mybatis</groupId>
   <artifactId>mybatis-spring</artifactId>
   <version>1.2.4</version>
  </dependency>
  
  <!-- 分頁(yè)管理需要的jar包,這里沒(méi)用到 -->
  <dependency>
   <groupId>com.github.pagehelper</groupId>
   <artifactId>pagehelper</artifactId>
   <version>4.2.1</version>
  </dependency>
  
 </dependencies>
 <build>
  <plugins> 
   <plugin> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <configuration> 
     <source>1.7</source> 
     <target>1.7</target> 
    </configuration> 
   </plugin> 
   <plugin> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.4</version> 
    <configuration> 
     <version>3.0</version> 
    </configuration> 
   </plugin> 
  </plugins> 
  <finalName>maven_SSM</finalName> 
 </build> 
</project>

這里說(shuō)一下maven工程利用pom.xml導(dǎo)入oracle驅(qū)動(dòng)包的問(wèn)題:

由于Oracle授權(quán)問(wèn)題,Maven不提供Oracle JDBC driver,為了在Maven項(xiàng)目中應(yīng)用Oracle JDBC driver,必須手動(dòng)添加到本地倉(cāng)庫(kù)。

如果電腦中已經(jīng)裝有Oracle數(shù)據(jù)庫(kù),則在安裝路徑下有數(shù)據(jù)庫(kù)的驅(qū)動(dòng)程序,可以直接用。D:\Oracle\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib

也可以直接到Oracle官網(wǎng)上下載Oracle數(shù)據(jù)庫(kù)驅(qū)動(dòng), 使用SQL語(yǔ)句查詢數(shù)據(jù)庫(kù)驅(qū)動(dòng)的版本: SELECT * FROM v$instance

然后確定版本下載:http://www.oracle.com/technetwork/database/features/jdbc/default-2280470.html

打開(kāi)windows的命令行界面,進(jìn)入驅(qū)動(dòng)包ojdbc6的目錄,然后運(yùn)行:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=12.1.0.2.0 -Dpackaging=jar -Dfile=ojdbc6.jar
顯示"BUILD SUCCESS" 成功,就會(huì)自動(dòng)導(dǎo)入你的maven本地倉(cāng)庫(kù)。

然后就可以在maven項(xiàng)目里添加dependency,各坐標(biāo)對(duì)應(yīng)上面這個(gè)命令的個(gè)元素,如下:

 <dependency>  
  <groupId>com.oracle</groupId>  
  <artifactId>ojdbc6</artifactId>  
  <version>12.1.0.2.0</version>
 </dependency> 

Spring的配置文件:applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
 xmlns:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p"
 xsi:schemaLocation="http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans.xsd 
 http://www.springframework.org/schema/aop 
 http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
 http://www.springframework.org/schema/tx 
 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
 http://www.springframework.org/schema/context 
 http://www.springframework.org/schema/context/spring-context-3.0.xsd
 http://www.springframework.org/schema/util 
 http://www.springframework.org/schema/util/spring-util-3.0.xsd
 ">

 <!-- 配置包掃描 -->
 <context:component-scan base-package="com.krry"></context:component-scan>
  
 <!-- 導(dǎo)入外部資源文件 -->
 <!-- <context:property-placeholder location="classpath:jdbc.properties" /> -->
 <bean class="com.krry.core.des.EncryptPropertyPlaceholderConfigurer"
  p:location="classpath:jdbc.properties" p:fileEncoding="utf-8" />
  
 <!-- proxool連接池 -->
 <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
  <!-- 驅(qū)動(dòng)的名字,mysql -->
  <property name="driver" value="${db.driver}"></property>
  <!--proxool 的 url連接串,這個(gè)必須確定用戶名和密碼 -->
  <property name="driverUrl" value="${db.url}"></property>
  <!-- 用戶名(proxool沒(méi)有使用,但是不能沒(méi)有) -->
  <property name="user" value="${db.username}"></property>
  <!-- 密碼(proxool沒(méi)有使用,但是不能沒(méi)有) -->
  <property name="password" value="${db.password}"></property>
  <!-- proxool自動(dòng)偵察各個(gè)連接狀態(tài)的時(shí)間間隔(毫秒),偵察到空閑的連接就馬上回收,超時(shí)的銷毀 現(xiàn)在設(shè)置為4秒) -->
  <property name="houseKeepingSleepTime" value="3000"></property><!-- 自動(dòng)檢查連接是否斷掉開(kāi)關(guān) -->
  <property name="testBeforeUse" value="true"></property>
  <!-- 如果發(fā)現(xiàn)了空閑的數(shù)據(jù)庫(kù)連接.house keeper 將會(huì)用這個(gè)語(yǔ)句來(lái)測(cè)試.這個(gè)語(yǔ)句最好非??斓谋粓?zhí)行.如果沒(méi)有定義,測(cè)試過(guò)程將會(huì)被忽略 -->
  <property name="houseKeepingTestSql" value="SELECT count(1) from dual"></property>
  <!-- 如果housekeeper 檢測(cè)到某個(gè)線程的活動(dòng)時(shí)間大于這個(gè)數(shù)值.它將會(huì)殺掉這個(gè)線程.所以確認(rèn)一下你的服務(wù)器的帶寬.然后定一個(gè)合適的值.默認(rèn)是5分鐘. 現(xiàn)在設(shè)置 10 秒--> 
  <property name="maximumActiveTime" value="10000"></property>
  <!-- 最少保持的空閑連接數(shù) (現(xiàn)在設(shè)置20個(gè)) -->
  <property name="prototypeCount" value="20"></property>
  <!-- 最大連接數(shù) (現(xiàn)在設(shè)置100個(gè)) -->
  <property name="maximumConnectionCount" value="200"></property>
  <!-- 最小連接數(shù) (現(xiàn)在設(shè)置50個(gè)) -->
  <property name="minimumConnectionCount" value="50"></property>
  <!-- 如果為true,那么每個(gè)被執(zhí)行的SQL語(yǔ)句將會(huì)在執(zhí)行期被log記錄(DEBUG LEVEL).你也可以注冊(cè)一個(gè)ConnectionListener (參看ProxoolFacade)得到這些信息. -->
  <property name="trace" value="false"></property>
  <property name="verbose" value="true"></property>
 </bean>
 
 <!-- 注冊(cè)事務(wù)管理器 -->
 <bean id="txMgr"
  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  <property name="dataSource" ref="dataSource"></property>
 </bean>

 <!-- 開(kāi)啟事務(wù)注解驅(qū)動(dòng) -->
 <tx:annotation-driven transaction-manager="txMgr" />
 
 <!-- 配置mybatis的sqlSessionFactory -->
 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  <property name="dataSource" ref="dataSource"></property>
  <property name="configLocation" value="classpath:mybatis-config.xml"></property>
 </bean>
 
 <!-- 配置可以整體掃描Mapper的一個(gè)掃描器 -->
 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  <!--如果有多個(gè)報(bào)路徑,用逗號(hào)分開(kāi)即可 -->
  <property name="basePackage" value="com.krry.mapper"></property>
  <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
 </bean> 
</beans>

spring MVC配置文件:springmvc.xml

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:p="http://www.springframework.org/schema/p"
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:util="http://www.springframework.org/schema/util" 
 xmlns:mvc="http://www.springframework.org/schema/mvc"
 xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/context 
  http://www.springframework.org/schema/context/spring-context-3.0.xsd
  http://www.springframework.org/schema/util 
  http://www.springframework.org/schema/util/spring-util-3.0.xsd 
  http://www.springframework.org/schema/mvc 
  http://www.springframework.org/schema/mvc/spring-mvc.xsd
  ">
   <!-- 開(kāi)啟注解模式驅(qū)動(dòng) --> 
  <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> 
  <!-- 開(kāi)啟mvc的注解模式 user 還會(huì)注冊(cè)一個(gè)ConversionService 子類FormattingConversionServiceFactoryBean-->
   <mvc:annotation-driven>
   <mvc:message-converters register-defaults="true">
    <bean class="com.krry.core.UTF8StringHttpMessageConverter">
     <property name="supportedMediaTypes">
      <list> 
       <value>text/plain;charset=UTF-8</value> 
       <value>text/html;charset=UTF-8</value> 
      </list> 
     </property>
    </bean> 
    <bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter"/>
    <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/> 
    <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
     <property name="prefixJson" value="false" />
     <property name="objectMapper">
       <bean class="com.fasterxml.jackson.databind.ObjectMapper">
        <!-- 處理responseBody 里面日期類型 --> 
        <property name="dateFormat"> 
         <bean class="java.text.SimpleDateFormat"> 
          <constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" /> 
         </bean> 
        </property> 
        <!-- 為null字段時(shí)不顯示 -->
        <property name="serializationInclusion">
         <value type="com.fasterxml.jackson.annotation.JsonInclude.Include">NON_NULL</value>
        </property> 
       </bean> 
     </property>
      <property name="supportedMediaTypes"> 
      <list> 
       <value>application/json;charset=UTF-8</value> 
       <value>application/x-www-form-urlencoded;charset=UTF-8</value> 
      </list> 
     </property>
    </bean>
    </mvc:message-converters> 
  </mvc:annotation-driven>
  
   <!-- 掃包 -->
   <context:component-scan base-package="com.krry.controller"></context:component-scan>
   
   <!--對(duì)靜態(tài)資源文件的訪問(wèn) 必須要設(shè)置,因?yàn)樵趕pringmvc的配置中配置了/匹配所有請(qǐng)求,
  此工程所有的請(qǐng)求(.do ,addUser,js/image/css)都會(huì)被springmvc解析,
  必須對(duì)所有的靜態(tài)資源文件進(jìn)行過(guò)濾放行 -->
  <!-- 靜態(tài)資源過(guò)濾 下面二選一-->
  <!--<mvc:default-servlet-handler/> -->
  <mvc:resources mapping="/resourse/**" location="/resourse/" />
  
  <!-- 攔截器定義 -->
  <mvc:interceptors> 
   <mvc:interceptor>
    <!-- 個(gè)人中心也需要登陸 以admin開(kāi)頭的配置都會(huì)進(jìn)行攔截-->
    <mvc:mapping path="/admin/**"></mvc:mapping> 
     <!-- 這個(gè)是設(shè)置不會(huì)進(jìn)入攔截器的路徑 -->
     <mvc:exclude-mapping path="/resourse/**"/>
   <!-- 攔截器進(jìn)入的類,返回false表示不會(huì)進(jìn)入輸入的路徑 -->
   <bean class="com.krry.core.filter.LoginInterceptor" />  
   </mvc:interceptor>
  </mvc:interceptors>
  
   <!-- 配置文件解析器 -->
  <bean id="multipartResolver"
   class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
   p:defaultEncoding="utf-8">
   <property name="uploadTempDir" value="/temp"></property>
   <property name="maxUploadSize">
    <value>209715200</value><!-- 200MB -->
   </property>
   <property name="maxInMemorySize">
    <value>4096</value><!-- 4KB大小讀寫(xiě) -->
   </property>
  </bean>
   
 
  <!-- 視圖渲染 jsp/freemaker/velocity-->
  <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <!-- 制定頁(yè)面存放的路徑 -->
    <property name="prefix" value="/WEB-INF/pages/"></property>
    <!-- 文件的后綴 -->
    <property name="suffix" value=".jsp"></property>
  </bean>  
</beans>

數(shù)據(jù)庫(kù)配置文件: jdbc.properties

 db.driver=oracle.jdbc.OracleDriver
 db.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
 db.username=4m+la23KCA4=
 db.password=WWijcIyMPaU\=

我這里使用了加密算法

日志配置文件: log4j.properties

log4j.rootLogger=DEBUG, CONSOLE, FILE

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %10l - %m%n

log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=D:/logs/log4j.log
log4j.appender.FILE.MaxFileSize=1MB
log4j.appender.FILE.Append = true
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy/MM/dd/HH:mm:ss} %-5p [%t] %10l - %m%n

mybatis配置文件: mybatis-config.xml

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE configuration 
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-config.dtd"> 

<configuration> 
 <settings> 
   <!-- 全局映射器啟用緩存 --> 
  <setting name="cacheEnabled" value="true" /> 
   <!-- 查詢時(shí),關(guān)閉關(guān)聯(lián)對(duì)象即時(shí)加載以提高性能 --> 
  <setting name="lazyLoadingEnabled" value="true" /> 
  <!-- 設(shè)置關(guān)聯(lián)對(duì)象加載的形態(tài),此處為按需加載字段(加載字段由SQL指    定),不會(huì)加載關(guān)聯(lián)表的所有字段,以提高性能 --> 
  <setting name="aggressiveLazyLoading" value="false" /> 
  <!-- 對(duì)于未知的SQL查詢,允許返回不同的結(jié)果集以達(dá)到通用的效果 --> 
  <setting name="multipleResultSetsEnabled" value="true" /> 
  <!-- 允許使用列標(biāo)簽代替列名 --> 
  <setting name="useColumnLabel" value="true" /> 
  <!-- 允許使用自定義的主鍵值(比如由程序生成的UUID 32位編碼作為鍵值),數(shù)據(jù)表的PK生成策略將被覆蓋 --> 
  <setting name="useGeneratedKeys" value="true" /> 
   <!-- 給予被嵌套的resultMap以字段-屬性的映射支持 --> 
  <setting name="autoMappingBehavior" value="FULL" /> 
  <!-- 對(duì)于批量更新操作緩存SQL以提高性能 --> 
  <setting name="defaultExecutorType" value="BATCH" /> 
   <!-- 數(shù)據(jù)庫(kù)超過(guò)25000秒仍未響應(yīng)則超時(shí) --> 
  <setting name="defaultStatementTimeout" value="25" /> 
   <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
 </settings> 
 
 <typeAliases>
  <!--自定義user對(duì)象的別名 -->
  <!-- <typeAlias type="com.krry.mybatis.sysmanage.entity.User" alias="user"/> -->
  <!-- 批量定義別名 -->
  <package name="com.krry.entity" />
 </typeAliases> 
</configuration>

網(wǎng)絡(luò)程序配置文件:web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
 
 <display-name>maven_SSM</display-name>
 
 <welcome-file-list>
 <welcome-file>index</welcome-file>
 </welcome-file-list>
 
 <!-- 加載Spring IOC容器 -->
 <context-param>
 <param-name>contextConfigLocation</param-name>
 <param-value>classpath:applicationContext.xml</param-value>
 </context-param>
 
 <!-- spring上下文監(jiān)聽(tīng)器 -->
 <listener>
 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
 
 <!-- Introspector緩存清除監(jiān)聽(tīng)器 -->
 <listener>
 <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
 </listener>
 
 <filter>
 <filter-name>encoding</filter-name>
 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
 <init-param>
  <param-name>encoding</param-name>
  <param-value>UTF-8</param-value>
 </init-param>
 </filter>
 
 <filter-mapping>
 <filter-name>encoding</filter-name>
 <url-pattern>/*</url-pattern>
 </filter-mapping>
 
 <!-- 配置DispatcherServlet -->
 <servlet>
 <servlet-name>maven_SSM</servlet-name>
 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
 <!-- 配置springMVC的配置文件 -->
 <!-- 如果不配置下面選項(xiàng),系統(tǒng)默認(rèn)加載classpath下面名為[servlet-name]-servlet.xml的文件 springmvc01-servlet.xml -->
 <init-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:springmvc.xml</param-value>
 </init-param>
 </servlet>
 
 <servlet-mapping> 
  <servlet-name>maven_SSM</servlet-name> 
  <url-pattern>/index</url-pattern> 
 </servlet-mapping>
 
 <!-- 可以配*.do, *.action(了解) / (重點(diǎn)): 所有的請(qǐng)求都會(huì)被spring mvc解析,但必須對(duì)靜態(tài)資源文件進(jìn)行過(guò)濾放行,建議大家使用這種方式 
  /* : 不建議大家使用 -->
 <servlet-mapping>
 <servlet-name>maven_SSM</servlet-name>
 <url-pattern>/</url-pattern>
 </servlet-mapping> 
</web-app>

到這里,基本配置全部完成,jar包也自動(dòng)依賴。就進(jìn)行測(cè)試和編寫(xiě)后續(xù) java 的代碼

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • java使用EasyExcel導(dǎo)入導(dǎo)出excel

    java使用EasyExcel導(dǎo)入導(dǎo)出excel

    導(dǎo)入導(dǎo)出excel數(shù)據(jù)是常見(jiàn)的需求,今天就來(lái)看一下Java基于EasyExcel實(shí)現(xiàn)這個(gè)功能,感興趣的朋友可以了解下
    2021-05-05
  • Java String類字符串的理解與認(rèn)知

    Java String類字符串的理解與認(rèn)知

    String字符串和char字符不同,char使用單引號(hào),只能表示一個(gè)字符,字符串就是一段文本。String是個(gè)類。這個(gè)類使用final修飾,所以這個(gè)類是不可以繼承擴(kuò)充和修改它的方法的
    2021-10-10
  • SpringBoot快速過(guò)濾出一次請(qǐng)求的所有日志的示例代碼

    SpringBoot快速過(guò)濾出一次請(qǐng)求的所有日志的示例代碼

    在現(xiàn)網(wǎng)出現(xiàn)故障時(shí),我們經(jīng)常需要獲取一次請(qǐng)求流程里的所有日志進(jìn)行定位,本文給大家介紹了SpringBoot如何快速過(guò)濾出一次請(qǐng)求的所有日志,文中有相關(guān)的代碼和示例供大家參考,需要的朋友可以參考下
    2024-03-03
  • 打包部署若依(RuoYi)SpringBoot后端和Vue前端圖文教程

    打包部署若依(RuoYi)SpringBoot后端和Vue前端圖文教程

    若依是一個(gè)使用Spring Boot作為后端和Vue.js作為前端的全棧應(yīng)用開(kāi)發(fā)平臺(tái),下面這篇文章主要給大家介紹了關(guān)于打包部署若依(RuoYi)SpringBoot后端和Vue前端的相關(guān)資料,需要的朋友可以參考下
    2024-05-05
  • Mybatis游標(biāo)查詢大量數(shù)據(jù)方式

    Mybatis游標(biāo)查詢大量數(shù)據(jù)方式

    這篇文章主要介紹了Mybatis游標(biāo)查詢大量數(shù)據(jù)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-02-02
  • 使用遞歸刪除樹(shù)形結(jié)構(gòu)的所有子節(jié)點(diǎn)(java和mysql實(shí)現(xiàn))

    使用遞歸刪除樹(shù)形結(jié)構(gòu)的所有子節(jié)點(diǎn)(java和mysql實(shí)現(xiàn))

    下面小編就為大家?guī)?lái)一篇使用遞歸刪除樹(shù)形結(jié)構(gòu)的所有子節(jié)點(diǎn)(java和mysql實(shí)現(xiàn))。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-10-10
  • 關(guān)于SpringMVC中數(shù)據(jù)綁定@ModelAttribute注解的使用

    關(guān)于SpringMVC中數(shù)據(jù)綁定@ModelAttribute注解的使用

    這篇文章主要介紹了關(guān)于SpringMVC中數(shù)據(jù)綁定@ModelAttribute注解的使用,SpringMVC是一個(gè)基于Spring框架的Web框架,它提供了一種簡(jiǎn)單、靈活的方式來(lái)開(kāi)發(fā)Web應(yīng)用程序,在開(kāi)發(fā)Web應(yīng)用程序時(shí),我們需要將用戶提交的數(shù)據(jù)綁定到我們的Java對(duì)象上,需要的朋友可以參考下
    2023-07-07
  • SWT(JFace)小制作 BugTracker

    SWT(JFace)小制作 BugTracker

    SWT(JFace)小制作 BugTracker
    2009-06-06
  • Java實(shí)現(xiàn)洗牌發(fā)牌的方法

    Java實(shí)現(xiàn)洗牌發(fā)牌的方法

    這篇文章主要介紹了Java實(shí)現(xiàn)洗牌發(fā)牌的方法,涉及java針對(duì)數(shù)組的遍歷與排序操作相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-07-07
  • 一文掌握SpringBoot多環(huán)境配置

    一文掌握SpringBoot多環(huán)境配置

    在實(shí)際項(xiàng)目的開(kāi)發(fā)過(guò)程中,我們程序往往需要在不同環(huán)境中運(yùn)行,每個(gè)環(huán)境中的配置參數(shù)可能都會(huì)有所不同,例如數(shù)據(jù)庫(kù)連接信息、文件服務(wù)器等等,下面小編給大家介紹SpringBoot多環(huán)境配置,感興趣的朋友一起看看吧
    2024-04-04

最新評(píng)論