Code Bye

为何本人用jetty+spring+mybatis+struts的框架搭的一个项目访问不了action

本人用的jetty7.6服务器,框架用的spring3+mybatis3+struts2,为何项目能正常启动,但是就是进不了action不管是form表单跳转,还是地址栏直接输入action都不行
下面贴下本人的文件内容:
================= web.xml ======================
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="web" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>application</display-name>
	<distributable />
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:spring.xml</param-value>
	</context-param>
	<!-- 定义Spring监听 -->  
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
<!-- 定义Log4j日志配置文件 -->  
    <context-param>  
        <param-name>log4jConfigLocation</param-name>  
        <param-value>classpath:log4j.properties</param-value>  
    </context-param> 
    
    <!-- 定义日志监听 -->  
    <listener>  
        <listener-class>  
            org.springframework.web.util.Log4jConfigListener  
        </listener-class>  
    </listener>  

	<!-- Spring 刷新Introspector防止内存泄露 -->
	<listener>
		<listener-class>
			org.springframework.web.util.IntrospectorCleanupListener</listener-class>
	</listener>
<filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
	<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>*.action</url-pattern>
	</filter-mapping>
<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.action</url-pattern>
	</filter-mapping>
	<!-- Welcome file lists -->
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<error-page>
		<error-code>404</error-code>
		<location>/404ErrorPage.html</location>
	</error-page>
	<error-page>
		<error-code>500</error-code>
		<location>/500ErrorPage.html</location>
	</error-page>
</web-app>

=======================struts.xml=======================

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
	<constant name="struts.devMode" value="false"/>
    <constant name="struts.configuration.xml.reload" value="false"/>
    <constant name="struts.i18n.encoding" value="UTF-8"/>
    <constant name="struts.action.extension" value="action"/>
    <constant name="struts.objectFactory" value="spring"/>
    <constant name="struts.multipart.maxSize" value="2097152"/>
    <constant name="struts.objectTypeDeterminer" value="tiger"/>
	<constant name="struts.ui.theme" value="simple"/>
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
	<constant name="struts.freemarker.templatesCache" value="false"/>
	<constant name="struts.custom.i18n.resources" value="application,global" />
	<constant name="struts.ui.templateDir" value="template" />
	<constant name="struts.objectFactory.spring.autoWire.alwaysRespect" value="true" />

	<package name="user" namespace="/user" extends="struts-default">
		<action name="userLogin.action" class="com.fyd.web.action.UserAction" method="login">
			<result name="SUCCESS">/sendMail.jsp</result>
		</action>
</package>

	<package name="default" namespace="/" extends="struts-default">  
        <default-action-ref name="index"/>  
        <action name="index" class="com.fyd.web.action.UserAction">  
            <result type="redirect">/index.jsp</result>  
        </action>  
 	</package>  
</struts>   

========================= spring.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:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	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.0.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">

	<!-- 采用注释的方式配置bean -->
	<context:annotation-config />
	<!-- 配置要扫描的包 -->
	<context:component-scan base-package="com.fyd"></context:component-scan>

	<!-- 数据库配置文件位置 -->
	<context:property-placeholder location="classpath:jdbc.properties" />
<!-- 配置dbcp数据源 -->
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
		<property name="driverClassName" value="${jdbc.driverClassName}" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
		<!-- 队列中的最小等待数 -->
		<property name="minIdle" value="${jdbc.minIdle}"></property>
		<!-- 队列中的最大等待数 -->
		<property name="maxIdle" value="${jdbc.maxIdle}"></property>
		<!-- 最长等待时间,单位毫秒 -->
		<property name="maxWait" value="${jdbc.maxWait}"></property>
<!-- 最大活跃数 -->
		<property name="maxActive" value="${jdbc.maxActive}"></property>
		<property name="initialSize" value="${jdbc.initialSize}"></property>
	</bean>

	<!-- 配置mybitasSqlSessionFactoryBean -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="configLocation" value="classpath:mybatis.xml"></property>
	</bean>
<!-- 事务配置 -->
	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>

	<!-- 使用annotation注解方式配置事务 -->
	<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>

============================ struts.properties ===========================

### These can be used to set the default HTTP and HTTPS  ports
struts.url.http.port = 80
#webwork.url.https.port = 443
### This can be used to set your locale and encoding scheme
struts.locale=zh_CN
struts.i18n.encoding=UTF-8
### Parser to handle HTTP POST requests, encoded using the MIME-type multipart/form-data
#webwork.multipart.parser=cos
struts.multipart.parser=jakarta
# uses javax.servlet.context.tempdir by default
webwork.multipart.saveDir=tmp
webwork.multipart.maxSize=2097152
struts.configuration.xml.reload=true
#struts.mapper.class=com.opensymphony.webwork.dispatcher.mapper.DefaultActionMapper
struts.action.extension=action
struts.objectFactory = spring   

========================= mybatis.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>
	<typeAliases>
		<typeAlias alias="user" type="com.fyd.web.entity.User"/>
	</typeAliases>
	<mappers>
		<mapper resource="com/fyd/web/ibatis/user.xml" />
	</mappers>
</configuration>

======================== index.jsp ========================

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <script data-dojo-config="async: true, tlmSiblingOfDojo: true, deps: ["application_client.js","application_server.js"]"
            src="${pageContext.request.contextPath}/dojo/dojo.js.uncompressed.js"></script>
    <script type="text/javascript">
var config = {
            contextPath: "${pageContext.request.contextPath}"
        };
    </script>
    <title>登录</title>
</head>
<body>
   <form action="${pageContext.request.contextPath}/user/userLogin.action" method="post" id="loginForm">
    		用户名:<input name="user.username" type="text"/>
    		密码:<input name="user.password" type="password"/>
    		<input type="submit" value="提交"/>
    </form>
</body>
</html>

报错截图如下

解决方案

40

应该是你的拦截

这个地方大致出错了,这样可以吗?毕竟本人已经好久没碰struts2
最好还是用springmvc+spring+mybatis
这个框架比较好,外加比你那个

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明为何本人用jetty+spring+mybatis+struts的框架搭的一个项目访问不了action