tags:

views:

572

answers:

2

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 entire frame work.

A: 

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".

foret
thank u for reply.Can you be more clear?
john
+1  A: 

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.

BalusC
Thanks a lot.Yes I read in user's guide but In my original web.xml javax.faces.webapp.FacesServlet servlet is there.Should I add resourse servlet in addition to that or replace the former.The commandlink is not navigating to jsp page which has primefaces tags according to faces-config.xml
john
Add it. I'd suggest to also learn "plain vanilla" JSP/Servlet. It look more like that you also don't know JSP/Servlet and thus can't understand how JSF works "under the hoods". Don't drive a space shuttle before being able to parachute.
BalusC