简体   繁体   English

如何使用primefaces和prettyfaces?

[英]how use primefaces and prettyfaces together?

Primefaces doesn't work when primefaces and pretty face use together. 当Primefaces和漂亮的脸一起使用时,Primefaces不起作用。 I add flowing jar: 我添加流动的jar:

prettyfaces-jsf2-3.3.3.jar
primefaces-4.0-20130605.174828-3.jar

My web.xml code: 我的web.xml代码:

<filter>
    <filter-name>Pretty Filter</filter-name>
    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>

<filter-mapping> 
    <filter-name>Pretty Filter</filter-name> 
    <url-pattern>/*</url-pattern> 
    <dispatcher>FORWARD</dispatcher> 
    <dispatcher>REQUEST</dispatcher> 
    <dispatcher>ERROR</dispatcher>
</filter-mapping> 

My pretty-config.xml code: 我的pretty-config.xml代码:

<rewrite match="^[^(/primefaces_resource/)|^(javascript)]" trailingSlash="append"  toCase="lowercase" redirect="301"/>
<url-mapping id="home"> 
    <pattern value="/" /> 
    <view-id value="/" />
</url-mapping> 

This image is whithou prittyface( jar and configure): 这个图像是whithou prittyface(jar和configure): 在此输入图像描述

when I add pretty face jar .then flowing view: 当我添加漂亮的脸罐。然后流动的视图: 在此输入图像描述

I want to change the url. 我想改变网址。

example: 例:

  (http://localhost:8084/AntSchoolMS/faces/index.xhtml)

I want it to be changed as 我想把它改成

(http://localhost:8084/AntSchoolMS/)

please help me . 请帮我 。

I use primefaces 3.5 with pretty faces 3.3.3 and works ok. 我使用primefaces 3.5与漂亮的脸3.3.3并且工作正常。 The configuration in your web.xml seems to be ok. web.xml中的配置似乎没问题。 Make sure you place pretty-config.xml also in WEB-INF. 确保将pretty-config.xml也放在WEB-INF中。 About the pretty-config you posted: it doesn't make any sense to have a url-mapping where the pattern and the view-id are the same, so remove it. 关于你发布的pretty-config:在模式和view-id相同的情况下有一个url-mapping没有任何意义,所以删除它。 Also I don't have that rewrite rule, I have several mappings like the folowing: 我也没有那个重写规则,我有几个映射如下:

<url-mapping id="login">
    <pattern value="/login/">
    <view-id value="/login.jsf" />
</url-mapping>

Did you try removing that rewrite rule to see what happens? 您是否尝试删除重写规则以查看会发生什么?

I've been using these two for some time and they are working as expected. 我已经使用这两个了一段时间,他们正在按预期工作。 My project used the 3.5 version of primefaces and PrettyFaces 3.3.3. 我的项目使用了3.5版本的primefaces和PrettyFaces 3.3.3。

In my web.xml I did not need to register any filter like you did. 在我的web.xml中,我不需要像你那样注册任何过滤器。

I would also try to remove the rewrite rule as Damian suggests. 我也会尝试删除重写规则,正如达米安所说。

另外,我建议升级到最新版本的PrettyFaces - 请参阅http://ocpsoft.org/prettyfaces/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM