我正在尝试将我的项目从struts2-core-2.3.37版本迁移到2.5.33,因为2.3.37版本中存在漏洞,并且我被要求从当前版本迁移它,我已经删除了早期版本的 jar 以及 xwork-core-2.3.37.jar,因为在文档中它是在版本注释 2.5 中编写的,XWork 源已合并到 Struts Core 源中,这意味着不再有 xwork 工件或专用的罐。 现在我的战争已成功运行并启动,控制台上没有错误,但当我尝试运行该应用程序时,它是一个空白屏幕。
这里是struts.xml文件 struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="false" />
<include file="/hissso/config/struts-hisso.xml"></include>
<include file="/hislogin/config/struts-hislogin.xml"></include>
<constant name="struts.action.excludePattern" value="/listener/.*?,/services/rest/[a-zA-Z_0-9]*,/hisssoServlet/.*?" />
</struts>
最后是从 struts.xml 调用的两个 xml 文件 struts-hisso.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="hissso" namespace="/hissso" extends="struts-default">
<action name="Login" class="hissso.controller.action.LoginACT">
<result name="INITIAL">/hissso/jsp/sso_login.jsp</result>
<result name="ERROR">/hissso/jsp/sso_error_page.jsp</result>
<result name="MAIN">/hissso/jsp/sso_main_login.jsp</result>
</action>
<action name="*Login" method="{1}" class="hissso.controller.action.LoginACT">
<result name="INITIAL">/hissso/jsp/sso_login.jsp</result>
<result name="ERROR">/hissso/jsp/sso_error_page.jsp</result>
<result name="MAIN">/hissso/jsp/sso_main_login.jsp</result>
<result name="DESK">/hislogin/UserDesk.action</result>
<!-- Chain to another namespace
<result name="DESK" type="chain">
<param name="actionName">UserDesk</param>
<param name="namespace">/hislogin</param>
</result>-->
</action>
</package>
</struts>
和我的struts-hislogin.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="hislogin" namespace="/hislogin" extends="struts-default">
<action name="*UserDesk" method="{1}" class="hislogin.transactions.action.UserDeskACT">
<result name="SUCCESS">/hislogin/transactions/jsp/st_login_desk.jsp</result>
<result name="ERROR">/application/jsp/app_error_page.jsp</result>
</action>
<action name="*LgnFtr" method="{1}" class="hislogin.transactions.action.LoginFeaturesACT">
<result name="FORGETPASSWORD">/hislogin/transactions/jsp/st_forgot_password.jsp</result>
<result name="FIRSTLOGIN">/hislogin/transactions/jsp/st_first_login_details.jsp</result>
<result name="CHANGEPASSWORD">/hislogin/transactions/jsp/st_change_password.jsp</result>
<result name="CHANGEUSERDETAILS">/hislogin/transactions/jsp/st_change_user_details.jsp</result>
<result name="USERLOGDETAILS">/hislogin/transactions/jsp/st_user_log_details.jsp</result>
<result name="ALERT">/hislogin/transactions/jsp/st_login_alert.jsp</result>
</action>
</package>
</struts>
请帮忙,因为我真的不知道哪里出了问题!!
我也面临同样的问题,我认为问题在于 jar 文件及其版本,以及您可能需要添加或删除一些其他 jar 文件。