1

我在一个战争档案中部署了几个主题。主题位于 /themes/html/ 下的 web 应用程序中。我正在尝试获取不同的主题以在“common”文件夹中创建指向资源的链接,该文件夹本身不是主题,而是放置在 /themes/html/common 中。具体来说,我的主题 Default.jsp 应该链接到公共文件夹中的脚本、图像和样式表。

到目前为止,我一直在尝试几种不同的方法

<link href='<portal-logic:urlFindInTheme file="../common/styles/main.css" />' type="text/css" rel="stylesheet"/>

不走运,只是将“about:blank”打印为href

然后我尝试将 common 文件夹注册为它自己的主题(“称为 CommonResources”)并尝试

<link href='<portal-logic:urlFindInTheme file="/styles/main.css" theme="CommonResources"/>' type="text/css" rel="stylesheet"/>

同样的结果,“关于:空白”。我也尝试了各种不同的门户逻辑:urlFind

<link href='<portal-logic:urlFind file="../common/styles/main.css" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="/common/styles/main.css" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="main.css" path="/common/styles" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="main.css" path="/common/styles" root="/" />' type="text/css" rel="stylesheet"/>
<link href='<portal-logic:urlFind file="main.css" path="/styles" root="/common" />' type="text/css" rel="stylesheet"/>

那里也一样,没有运气。这些不会导致:空白,只是href中的空字符串。

或者,我试过这个

<link href="<%= request.getContextPath() %>/themes/html/common/styles/main.css" type="text/css" rel="stylesheet" />

问题在于 request.getContextPath() 返回一个空字符串。我可以将上下文硬编码到主题应用程序中,但出于显而易见的原因,我更愿意避免这种情况。

像往常一样,IBM 文档完全没用。是关于信息中心中记录的所有内容,我还没有遇到任何更有用的东西。反编译 IBM jar:s 几乎已成为我的第二天性,但尝试遵循门户中的内部查找器逻辑只会让我非常头疼。

那么,有没有人能够从主题应用程序内部访问外部资源?你会认为这是通常做的事情,但我开始怀疑。

4

1 回答 1

0

Answering my own question...

Turns out the problem was url caching inside the WAS.

<link href='<portal-logic:urlFindInTheme file="../common/styles/main.css" />' type="text/css" rel="stylesheet"/>

Is correct and works. My problem was that websphere had already cached that /common/styles/main.css didn't exist from a previous request (before I deployed it there). Seems these URL caches don't get purged just because you redeploy an application. I changed the folder name to common2 and redeployed just to force WebSphere to re-run the internal finder and then it worked.

于 2011-08-05T07:24:16.557 回答