gpt4 book ai didi

java - 在服务器上运行 struts2 应用程序时出现 http 状态 404

转载 作者:行者123 更新时间:2023-12-01 13:36:33 25 4
gpt4 key购买 nike

这个问题可能听起来重复,但事实是我还没有收到解决方案。我刚刚进入 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>

最佳答案

HTTP 状态 404 已解决 - 在 Struts2

要解决此问题,请仅在 lib 文件夹中复制下面提到的 10 个 jar 文件。

commons-fileupload-1.3.1.jar,
commons-io-2.2.jar,
commons-lang-2.4.jar,
commons-lang3-3.2.jar,
commons-logging-api-1.1.jar,
freemarker-2.3.19.jar,
javassist-3.11.0.GA.jar,
ognl-3.0.6.jar,
struts2-core-2.3.20.1.jar,
xwork-core-2.3.20.1.jar

希望它能起作用..谢谢:)

关于java - 在服务器上运行 struts2 应用程序时出现 http 状态 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21230874/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com