【发布时间】:2014-01-20 09:55:28
【问题描述】:
这个问题听起来可能是重复的,但事实上我还没有收到解决方案。我刚刚进入 struts2 并尝试登录应用程序。我附上了以下库:
commons-fileupload-1.2.2.jar
commons-io-1.4.jar
commons-lang-2.4.jar
commons-logging-1.0.4.jar
freemarker-2.3.15.jar
javassist-3.14.0-GA.jar
ognl-2.6.11.jar
struts2-core-2.0.14.jar
struts2-core-2.1.6.jar
xwork-2.0.7.jar
当我单独运行正常的 JSP 页面(没有 struts 标签)时,它运行正常。但是每当我单独运行带有struts 标记的jsp 页面时,它都会显示http error 500。创建整个 web.xml 和 struts.xml 并运行整个应用程序后,它会报告 http status 404。我知道问题是我的 jsp 页面没有被识别。请帮忙。
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Struts2 Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
</web-app>
struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation"
value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources"
value="ApplicationResources" />
<package name="default" extends="struts-default" namespace="/">
<action name="login"
class="com.vvv.struts.LoginAction">
<result name="success">Welcome.jsp</result>
<result name="error">Login.jsp</result>
</action>
</package>
</struts>
【问题讨论】:
-
为什么不升级到最新版本?