JSF urlrewrite 不起作用



我想隐藏我的页面扩展而不使用漂亮的面孔,因为它很难使用,我对使用它感到困惑,现在我正在使用Tuckey http://tuckey.org/urlrewrite/

我有这个链接: 本地主机1:8080/控制/登录.xhtml

so i want it like : localhost1:8080/control/login

我的代码是:

<urlrewrite>
<rule>
    <note>
        The rule means that requests to /test/status/ will be redirected to /rewrite-status
        the url will be rewritten.
    </note>
    <from>login.xhtml</from>
    <to type="redirect">control/login</to>
</rule>

但它给了我:

HTTP Status 404 - /control/login
 for that link : 
 localhost:8080/control/login

由于您要重定向到控件/登录,因此还需要定义一个导航规则,该规则将此 URL 映射到 xhtml 页面。

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">

<navigation-rule>
<from-view-id>*.xhtml</from-view-id>
<navigation-case>
    <from-outcome>control/login</from-outcome>
    <to-view-id>login.xhtml</to-view-id>
</navigation-case>
</navigation-rule>

</faces-config>

最新更新