使用 Apache Tiles
在我的时区下午好。
我正在开发一个已经生产了一年多的项目,应用程序服务器运行的是J2EE 1.3版本。现在我尝试使用apachetiles框架将内容与布局分离。该项目在WEB- INF/lib 以下实现STRUTS框架的库 -struts1.2.6 -struts-core-1.3.10 -struts-extras-1.3.10.jar -struts-taglib-1.3.10.jar
在这个介绍之后我的噩梦开始了: 1) 为了配置 Tiles,我将以下代码添加到 struts-config.xml:
<action path="/tilesTest"
parameter="aDef"
type="org.apache.struts.actions.ForwardAction" />
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tilesdefs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
'aDef' 参数在tilesdefs.xml 中定义。 当我在浏览器中调用该操作时,它会抛出以下异常:
java.lang.NoSuchMethodError: org.apache.struts.config.ForwardConfig.getContextRelative()Z org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:289)
经过调查,我发现了一篇帖子,内容如下:
检查应用程序 lib 文件夹以找到 struts-core-1.3.8。 jar 以及 struts.jar。正是因为如此,才引发了异常。 struts.jar有forwardConfig类和getContextRelative()方法。 struts-core-1.3.8.jar具有forwardConfig类,但没有getContextRelative()方法。 这是导致问题的原因。 因此删除struts.jar以便使用1.3.8版本。 -- 另外将 struts-extras-1.3.8.jar 添加到应用程序库
就像我在乞求中告诉我的那样,我有相同的两个库,唯一的问题是,它是 struts.jar 库具有图块包,struts-core-1.3.8没有该包。 那么我应该做什么,在这个应用程序中运行图块?
抱歉问题扩展,但我必须解释所有情况。 此致 提前感谢任何试图帮助我的人
Good afternoon in my timezone.
I am working on a project that is in production for over one year, the application server is running the J2EE 1.3 version.Now i am trying to use the apache tiles framework to separate the content from the layout.The project has in the WEB-INF/lib the following libraries that implement the STRUTS framework
-struts1.2.6
-struts-core-1.3.10
-struts-extras-1.3.10.jar
-struts-taglib-1.3.10.jar
After this introduction my nightmare begun:
1) To configure the Tiles i added the following code to my struts-config.xml:
<action path="/tilesTest"
parameter="aDef"
type="org.apache.struts.actions.ForwardAction" />
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tilesdefs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
The 'aDef' parameter is defined in the tilesdefs.xml.
When i call the action in the browser, it throws me the following exception:
java.lang.NoSuchMethodError: org.apache.struts.config.ForwardConfig.getContextRelative()Z
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:289)
After investigation i found a post saying the following :
Checked the application lib folder to find struts-core-1.3.8.jar as well as struts.jar. It is because of this that the exception was thrown.
struts.jar has the forwardConfig class and getContextRelative() method.
struts-core-1.3.8.jar has the forwardConfig class , but not the getContextRelative() method.
This was causing the issue.
Therefore remove struts.jar so that 1.3.8 version is used.
-- Additionally add struts-extras-1.3.8.jar to the application lib
Like i told in the begging i have the same two libs, the only problem is, it is the struts.jar lib that have the tiles package, the struts-core-1.3.8 do not have that package.
So what i am suppose to do , to run tiles in this application ?
Sorry for the question extension but i have to explain the all situation.
Best regards
THANKS IN ADVANCE to anyone that tries to help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
修复你的类路径。在类路径中拥有两个不同版本的 Struts 没有多大意义。 Struts 1.3.10 的tiles 类位于与struts-1.3.10 捆绑在一起的struts-tiles-1.3.10.jar 中。
Fix your classpath. It doesn't make much sense to have two different versions of Struts in the classpath. The tiles classes for Struts 1.3.10 are in struts-tiles-1.3.10.jar bundled with struts-1.3.10.