0

我的 struts-config.xml 有一些指向切片定义的前向操作。但是它需要路径,因为它是给定的&不指向tiles-definition.xml&显示路径不是以"/"字符 开头

我的 struts-config.xml 是:

<?xml version="1.0" encoding="UTF-8"?>    

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
   <data-sources />
<form-beans >
   <form-bean name="feelSafeForm" type="com.feelsafe.struts.form.FeelSafeForm" />
</form-beans>
<global-exceptions />
<global-forwards >
   <forward name="login1" path="/feelSafe.do?do=login" />
   <forward name="admin" path="/feelSafe.do?do=admin1" />
</global-forwards>
<action-mappings >
<action
  attribute="feelSafeForm"
  input="/index.jsp"
  name="feelSafeForm"
  parameter="do"
  path="/feelSafe"
  scope="request"
  type="com.feelsafe1.struts.action.FeelSafeAction">

  <forward name="adminmainpage" path="feelsafe.adminmainpage" />
  <forward name="login" path="feelsafe.login" />

 </action>

</action-mappings>

<message-resources parameter="com.feelsafe.struts.ApplicationResources" />

<plug-in className="org.apache.struts.tiles.TilesPlugin">
   <set-property property="definitions-parser-validate" value="true" />
   <set-property property="moduleAware" value="true" />
   <set-property property="definitions-config" value="/WEB-INF/tiles-definition.xml" />
</plug-in>

</struts-config>

瓷砖-definition.xml 是:

<!DOCTYPE tiles-definitions PUBLIC
   "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
   "http://struts.apache.org/dtds/tiles-config_1_1.dtd">     
<component-definitions>

<definition name="feelsafe.common" path="/feelsafeLayout/layout.jsp">
   <put name="title" type="string" value="FeelSafe Hospital"/>
   <put name="header1" value="/feelsafeLayout/header.jsp"/>
   <put name="footer1" value="/feelsafeLayout/footer.jsp"/>
</definition>

<definition name="feelsafe.login" extends="feelsafe.common">
   <put name="body1" value="/feelsafeJspFiles/login.jsp"/>
</definition> 

<definition name="feelsafe.admin" extends="feelsafe.common">
   <put name="body1" value="/feelsafeAdminJspFiles/adminlogin.jsp"/>
</definition>

</component-definitions>  

调用登录时,控制转到转发标签并给出500 Error

org.apache.jasper.JasperException:javax.servlet.ServletException:javax.servlet.jsp.JspException:名称 login1 的异常转发:javax.servlet.ServletException:java.lang.IllegalArgumentException:路径 feelsafe.login 不以“ /“ 特点

4

1 回答 1

1

当我从 web.xml 中的操作 servlet 的 init 参数中删除此代码段时,我得到了同样的错误

    ...
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    ...
    <init-param>
        <param-name>chainConfig</param-name>
        <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
    </init-param>

因此,当您使用 1.1 等旧版本的 dtd 时,请尝试将此 init-param to action servlet 添加到您的 web.xml 文件中。我在 1.3 上测试过

于 2014-10-23T09:19:23.377 回答