【问题标题】:Jsf urlrewrite not workingJsf urlrewrite 不起作用
【发布时间】:2013-11-08 02:27:13
【问题描述】:

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

我有这个链接: localhost1:8080/control/login.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

【问题讨论】:

    标签: java jsf jsf-2 url-rewriting tuckey-urlrewrite-filter


    【解决方案1】:

    由于您要重定向到 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>
    

    【讨论】:

    • 没有新的事情发生,我已经在 faces config 中更改了它,但仍然是相同的链接给我 404
    猜你喜欢
    • 1970-01-01
    • 2011-04-26
    • 2011-12-08
    • 1970-01-01
    • 1970-01-01
    • 2019-12-27
    • 2012-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多