我正在尝试一个简单的URL重写示例,但它并不适用于我。我正在使用部署到JBoss 5.1.0的Seam 2.2.0。
我的pages.xml包含:
<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包含:
<web:rewrite-filter view-mapping="*.seam"/>
据我在文档中可以看出,这应该是我所需要的。但是,没有内部链接显示不同,如果输入URL:http://mysite/home或mysite / link?param = something,我只得到404页面。我错过了什么?
答案 0 :(得分:0)
答案 1 :(得分:0)
来自接缝文件:
“视图映射参数必须与web.xml文件中为Faces Servlet定义的Servlet映射匹配。如果省略,重写过滤器将采用模式* .seam。”
答案 2 :(得分:0)
我不知道为什么你的方法不起作用。但不要忘记,您可以将viewName.page.xml
文件用于同一目的
例如,由于页面名称为index.xhtml
,您必须在包含index.page.xml
文件的同一文件夹中创建index.xhtml
文件(在html
内的情况下)夹)。
在index.page.xml
文件中添加此内容。
<rewrite pattern="/home" />
正如您所做的那样,component.xml
文件应包含第
<web:rewrite-filter view-mapping="*.seam"/>
再次部署,它应该可以工作。