2013-10-10 55 views
1

我正在嘗試用於REST URL映射到JSF2頁面的prettyfaces庫。簡單的休息映射到頁面

我第一次設立的Maven的pom.xml prettyfaces:

<dependency> 
      <groupId>com.ocpsoft</groupId> 
      <artifactId>prettyfaces-jsf2</artifactId> 
      <version>3.3.3</version> 
     </dependency> 

然後我漂亮-config.xml中:

<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.2" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.2 
             http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.2.xsd"> 

    <url-mapping id="view-marchi"> 
     <pattern value="/marchi/{urlMarchio}" /> 
     <view-id value="/marchio.xhtml" /> 
    </url-mapping> 

</pretty-config> 

我在我的web應用程序的根文件夾marchio.xhtml。它可以直接訪問:www..com/marchio.xhtml。

但是如我所料的映射不起作用:

www..com/MARCHI/testparam

404 - 未找到!

我不明白......我做錯了什麼?或者也許有一些配置錯誤..?

+1

Appart酒店,看看[這裏](http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US /html/Configuration.html#config.pathparams) –

+0

@Kocko是正確的。您錯過了#{#}前的# – Lincoln

回答

3

我相信映射中的參數必須匹配#{param-name}。正如我所看到的,你錯過了#。改變你的模式在URL映射到:從@kocko說什麼

<pattern value="/marchi/#{urlMarchio}" />