开发者

how to combine jsf tags with prime faces?

开发者 https://www.devze.com 2023-01-08 09:08 出处:网络
I am using jsf and jsp tags in apache server for web applicationand I want to use primefaces for graphs.I don\'t no exactly how to configure web.xml when primefaces jar file is used.and how the jsp pa

I am using jsf and jsp tags in apache server for web application and I want to use primefaces for graphs.I don't no exactly how to configure web.xml when primefaces jar file is used.and how the jsp page will be having code using primefaces tags and components.please give simple example.I want to use prime faces only for graphs and its a small part of application.I dont want to change开发者_如何学C entire frame work.


Learn finding and reading documentation. As every decent library, Primefaces comes along with documentation. You need the Users Guide (PDF). Check chapter 2.3 and on. Assuming you're using JSF 2.0 (who want to start with 1.2 nowadays?), here's an extract of relevance:

2.3.2 JSF 2.0 with PrimeFaces 2.x

Resource Servlet

Although PrimeFaces 2.x uses JSF2 resource APIs to place resources on page, due to limitations of JSF2 resource loading mechanism, PrimeFaces Resource Servlet is required to stream the resources from the bundle. If youʼre running PrimeFaces in a Servlet 3.0 environment like Glassfish V3, this servlet is auto-registered so you donʼt need to configure it manually.

<servlet>
    <servlet-name>Resource Servlet</servlet-name>
    <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
</servlet>
    <servlet-mapping>
    <servlet-name>Resource Servlet</servlet-name>
    <url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>

Allowing Text Children

When using Mojarra 2.x, enable allowTextChildren configuration.

<context-param>
    <param-name>com.sun.faces.allowTextChildren</param-name>
    <param-value>true</param-value>
</context-param>

Chapter 2.4 contains some Hello World code. Have a look at it yourself. And the remnant of the guide as well.

Coming back to your statement:

I dont want to change entire frame work.

Primefaces is also not a "complete framework". It's just a JSF component library. You can keep your primary JSF implementation and existing JSF work.


if i'm not mistaken, you should only set namespace, just like you do it for h:... and f:.... Didn't work with prime faces components so i don't know it's namespace.
Example from my project (it uses facelets):
ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:t="http://myfaces.apache.org/tomahawk"
Just do smth like that: xmlns:prime="primefaces_uri".

0

精彩评论

暂无评论...
验证码 换一张
取 消