Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 931861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:34:19+00:00 2026-05-15T20:34:19+00:00

i am using primefaces library this is my jsp page source: <%@taglib uri=http://primefaces.prime.com.tr/ui prefix=p%>

  • 0

i am using primefaces library this is my jsp page source:

<%@taglib uri="http://primefaces.prime.com.tr/ui" prefix="p"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<f:view>
<head>
  <p:resources />
  <base href="<%=basePath%>">

  <title>My JSP 'index.jsp' starting page</title>
</head>

<body>

   <h:form>
    <h:outputText id="txt_count" value="#{counterBean.count}" />
    <p:poll actionListener="#{counterBean.increment}" update="txt_count" />
   </h:form>

</body>

  </f:view>
</html>

and my back bean code is :

import javax.faces.event.ActionEvent;


public class CounterBean {
private int count;
public void increment(ActionEvent actionEvent) {
count++;
}
//getters and setters
public int getCount() {
 return count;
}
public void setCount(int count) {
 this.count = count;
}
}

my web.xml is as follows

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
  </servlet-mapping>
  <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>
  <welcome-file-list>
    <welcome-file>test.jsp</welcome-file>
  </welcome-file-list>
</web-app>

my pages loads correctly but it’s not regulary updated

when it is loaded it says that “yahoo is not defined” and so it does not work.

i have defined resources servlet and but it does not work yet!

please help me!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:34:19+00:00Added an answer on May 15, 2026 at 8:34 pm

    You’re apparently using PrimeFaces 2.0 on JSF 2.0. The p:resources is deprecated in JSF 2.0. You should be using Facelets instead of JSP. If anything went right, you should have seen the following entry in the server logs:

    INFO: p:resources component is deprecated and has no use in PrimeFaces 2.0 as
          JSF 2.0 resource apis are used instead to place resources on page.
    

    Because the resources are not included in the page, the required JavaScript files are not included and the generated JavaScript code cannot find the Yahoo library reference, hence the JS error you retrieved. If you have rightclicked the webpage in browser and checked the generated HTML source, you should have noticed the lack of <script> includes as well.

    To fix this, dump JSP forever and go use Facelets. It’s the successor of JSP and far more superior when taking JSF into picture.

    Rename the *.jsp file to *.xhtml and use the following code:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" 
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.prime.com.tr/ui">
        <h:head>
            <title>My Facelets 'index.xhtml' starting page</title>
            <base href="//#{request.serverName}:#{request.serverPort}#{request.contextPath}"></base>
        </h:head>
        <h:body>
           <h:form>
               <h:outputText id="txt_count" value="#{counterBean.count}" />
               <p:poll actionListener="#{counterBean.increment}" update="txt_count" />
           </h:form>
        </h:body>
    </html>
    

    When reading JSF books/tutorials ensure that you’re reading the ones covering JSF 2.0, not 1.x.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using JSF 2.0 and PrimeFaces library. I have a page with several inputs
why the targetAttributeName is not recognized in my composite component <html xmlns=http://www.w3.org/1999/xhtml xmlns:h=http://java.sun.com/jsf/html xmlns:f=http://java.sun.com/jsf/core
I am using PrimeFaces JSF library and the following code to open a page
I am using PrimeFaces p:messages but I think this question applies equally to h:messages
I am using PrimeFaces 2.1 to show a dialog like this: <p:dialog header=Test modal=true
I am Using primefaces and Jsf with glassfish when i try to execute this
I am using PrimeFaces UI library and JSF 2. I have a backing bean:
I'm developing an application in JSF 2.0. I'm also using the Primefaces component library.
I'd like to place a whole page inside a PrimeFaces library UI component lightBox
I'm using JSF2.0 and Eclipse Indigo, and just recently I added the PrimeFaces library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.