当前位置: 代码迷 >> Java Web开发 >> spring3注脚 struts2 action访问不到
  详细解决方案

spring3注脚 struts2 action访问不到

热度:2260   发布时间:2016-04-10 23:31:17.0
spring3注解 struts2 action访问不到
ssh集成(struts2,spring3,hibernate4)
使用spring3的注解,项目启动后点击登录访问不到action
求懂得spring3注解技术的帮忙指点一下!谢谢了!

HTTP Status 404 - /oa/login.action

--------------------------------------------------------------------------------

type Status report

message /oa/login.action

description The requested resource is not available.


--------------------------------------------------------------------------------

Apache Tomcat/7.0.47





配置如下:

web.xml
--------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 
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_3_0.xsd">
<display-name>bonsoftoa</display-name>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
         <param-name>config</param-name>
         <param-value>struts-default.xml,struts-plugin.xml,/struts.xml</param-value>
     </init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>sessionTimeout</param-name>
<param-value>1800</param-value>
</context-param>
<listener>
<listener-class>com.oa.util.session.AppSessionListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/spring/**/*.xml</param-value>
</context-param>
</web-app>



struts.xml
------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.objectFactory" value="spring" />
<package name="web"  extends="struts-default">        
<action name="login" class="loginAction">
<result name="success">/index.jsp</result>
</action>  
</package>
</struts>




spring的配置文件
----------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans  xmlns:p="http://www.springframework.org/schema/p"
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"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">


    <context:annotation-config/>

    <context:component-scan base-package="com.oa.login.action"/>
      
  
   <bean
        id="environmentVariablesConfiguration"
        class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig"
        p:algorithm="PBEWITHMD5ANDDES"
        p:passwordEnvName="APP_ENCRYPTION_PASSWORD" />

    <bean
        id="configurationEncryptor"
        class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"
        p:config-ref="environmentVariablesConfiguration" />

    <bean
        id="propertyConfigurer"
        class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer" >
  相关解决方案