国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

java - Strtus2 跳轉(zhuǎn)到WEB-INF/content下
天蓬老師
天蓬老師 2017-07-03 11:43:28
0
2
1084

使用strtus2,action進行跳轉(zhuǎn)的時候,自動跳轉(zhuǎn)到WEB-INF/content目錄下。不知道哪里出問題了。

我是把所有的文件都放在了webroot下,

下面是我的幾個文件

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <!-- 1. listener 2.Filter 3.servlet 4.welcome-file-list  -->

    <!--========================== 1. 配置Spring========================== -->

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- ==========================配置struts2========================== -->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

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:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
  
 <!-- ==================1.基于注解,掃描包============================= -->
 <context:component-scan base-package="com.demo.*"></context:component-scan>
 
  <!-- ==================2.數(shù)據(jù)源配置============================= -->
 <context:property-placeholder location="classpath:config/DBconfig.properties"/>
 
 <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"  
          p:driverClassName="${driverClassName}"
          p:url="${url}"
          p:username="${username}"
          p:password="${password}" 
          >
  </bean>
  
  <!--==================3.JdbcTemplate=============================  -->
  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
           <property name="dataSource" ref="dataSource"></property>
   </bean>
   
  <!-- ==================4.事務(wù)管理(AOP : Aspect Oriented Programming)============================= -->
  <!--(a) 配置事務(wù)對象: -->
      <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
          <property name="dataSource" ref="dataSource"></property>
      </bean>
      
      <tx:annotation-driven transaction-manager="txManager"/>
  
   <!-- (b) AOP橫切事務(wù) -->
   <aop:config>
           <aop:pointcut  id="txPC"  expression="execution(* com.demo.dao..*.*(..))"/>
           <aop:advisor advice-ref="txAdvice" pointcut-ref="txPC"/>
   </aop:config>
   
    <!--(c) 事務(wù)屬性定義-->
   <tx:advice id="txAdvice" transaction-manager="txManager">
       <tx:attributes>
           <tx:method name="query*" read-only="true" />
           <tx:method name="save*" propagation="REQUIRED" />
           <tx:method name="add*" propagation="REQUIRED" />
           <tx:method name="update*" propagation="REQUIRED" />
           <tx:method name="delete*" propagation="REQUIRED" />
       </tx:attributes>
       
   </tx:advice>
 
  </beans>

頁面代碼

天蓬老師
天蓬老師

歡迎選擇我的課程,讓我們一起見證您的進步~~

全部回復(fù)(2)
Peter_Zhu

配置路徑應(yīng)該加上WEB-INF吧

滿天的星座

已經(jīng)解決了,原來是我action-->location中沒有加“/”。

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板