Seam 2.2.0 URL 重写不起作用 [英] Seam 2.2.0 URL rewrite not working
问题描述
我正在尝试一个简单的 URL 重写示例,但它对我不起作用.我正在使用部署到 JBoss 5.1.0 的 Seam 2.2.0.
I'm trying a simple example of URL rewriting, but it's not working for me. I'm using Seam 2.2.0 deployed to JBoss 5.1.0.
我的 pages.xml 包含:
My pages.xml contains:
<page view-id="/html/index.xhtml">
<rewrite pattern="/home" />
</page>
和
<page view-id="/html/common/redirect.xhtml" action="#{redirectAction.redirect}">
<rewrite pattern="/link" />
...
我的 components.xml 包含:
My components.xml contains:
<web:rewrite-filter view-mapping="*.seam"/>
据我从文档中可以看出,这应该是我所需要的.但是,没有任何内部链接出现不同,如果输入 URL:http://mysite/home 或 mysite/link?param=something,我刚得到一个 404 页面.我错过了什么?
As far as I can tell from the documentation, that should be all I need. However, none of the internal links appear different, and if enter the URL: http://mysite/home or mysite/link?param=something, I just get a 404 page. What am I missing?
推荐答案
我不知道为什么你的方法不起作用.但是不要忘记您可以将 viewName.page.xml
文件用于相同的目的.
例如,由于您的页面名称是 index.xhtml
,您必须在包含 index.html 的同一文件夹中创建
文件(在您的情况下位于 index.page.xml
文件.xhtmlhtml
文件夹内).
I don't know why you approach is not working. But don't forget that you can use viewName.page.xml
file for the same purpose.
For an example since the name of your page is index.xhtml
you have to create the index.page.xml
file inside the same folder which contains the index.xhtml
file(in your case inside the html
folder).
在 index.page.xml
文件中添加这个.
In index.page.xml
file add this.
<rewrite pattern="/home" />
因为你已经在做你的 component.xml
文件应该包含该行
As you are already doing your component.xml
file should contain the line
<web:rewrite-filter view-mapping="*.seam"/>
再次部署,它应该可以工作了.
Deploy again and it should work.
这篇关于Seam 2.2.0 URL 重写不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!