本文介绍了瘦的WAR,EAR中的库:“未找到struts-tags”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在Java EE项目中,我将所有库从 WAR / WEB-INF / lib 移动到 EAR / lib

In a Java EE project, I moved all the libraries from the WAR/WEB-INF/lib to the EAR/lib.

打开JSP,现在我收到此错误:

Opening a JSP, now I get this error:

Stacktraces
org.apache.jasper.JasperException: File "/struts-tags" not found
...........
...........


如何解决这个问题?

推荐答案

将库从WAR移到EAR可能非常有用,例如如果在一个EAR中有多个WAR *,则为了避免库的冗余。


Moving the libraries from the WAR to the EAR may be very useful, e.g. if you have more than one WAR* inside one EAR, to avoid redundancy of libraries.


制作(没有库的WAR)工作,条件是:


To make a Skinny WAR (a WAR without libraries) work, the conditions are:


  1. WAR的 META-INF / MANIFEST.MF 必须包含链接库的Class-Path属性:

  1. The WAR's META-INF/MANIFEST.MF must contain a Class-Path property linking your libraries:

Class-Path: lib/struts2-core-2.3.15.2.jar
            lib/xwork-core-2.3.15.2.jar
            lib/all_your_libraries_here...


  • EAR的 application.xml 必须包含:

    < library-directory> lib< / library-directory>

    要在Maven上实现这个条件,不需要在EAR的POM.xml中声明WAR的POM.xml的每个库的依赖关系,可以使用。

    To achieve this conditions on Maven, without the need of declaring the dependency of each library of WAR's POM.xml in EAR's POM.xml, you can use this amazing trick.

    那说,问题在问题中报告的事实是 TLD 查询仅在WAR上执行,EAR超出范围

    That said, the problem reported in the question is given by the fact that the TLD lookup is performed on the WAR only, the EAR is out of scope.

    解决方案:

    struts2-core-2.3.xxjar struts-tags.tld c $ c>,并将其置于(每个) WAR / WEB-INF 文件夹。

    extract the struts-tags.tld from struts2-core-2.3.x.x.jar, and place it under (each) WAR/WEB-INF folder.

    在JSP中:

    <%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld" %>
    

    这篇关于瘦的WAR,EAR中的库:“未找到struts-tags”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    1403页,肝出来的..

  • 09-07 01:36