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

  • Home
  • SEARCH
  • 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 8117355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:08:27+00:00 2026-06-06T04:08:27+00:00

In PrimeFace’s inputText , I need to call function ‍‍‍ f1() when any key

  • 0

In PrimeFace’s inputText, I need to call function ‍‍‍f1() when any key is pressed.

To implement this, in xhtml file I have:

<p:inputText id="userName" onkeyup="#{myBean.f1()}" >

And in my MyBean.java i have declared this function:

public void f1()
{
// somecode
}

‌But this code throws an exception:

javax.faces.FacesException: javax.el.ELException: /index.xhtml
@103,191 onkeyup=”#{MyBean.f1()}”: java.lang.NullPointerException

  • 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-06-06T04:08:29+00:00Added an answer on June 6, 2026 at 4:08 am

    If you want to call a java method you should use p:ajax event instead of onkeyup attribute

    <p:inputText id="userName">
         <p:ajax event="keyup" listener="#{myBean.f1}"></p:ajax>
    </p:inputText>
    

    onkeyup : Client side callback to execute when a key is released over
    input element.

    in other words onkeyup is for calling js functions like onkeyup="alert('hello')"

    about the exception you got : its cause you page tried to execute the f1 method on page load and not on keyup event – for example if you f1 method would have return a string that string would replace the #{myBean.f1()} and your generated page would look like this:

    ... onkeyup="string value returned from f1 method" ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am new to primeface. i have tried to test an example of primefaces
I am working with primefaces. I need to write a java script function that
I have a problem with using primeface's wizard component and the core selectOneRadio. My
I am using JSF 2.0 and PrimeFaces 2.2.1. In my template.xhtml, I have a
I am using Eclipse to work with PrimeFaces like this: <ui:composition xmlns=http://www.w3.org/1999/xhtml xmlns:ui=http://java.sun.com/jsf/facelets xmlns:h=http://java.sun.com/jsf/html
I am using primeface 3.2. i am using ajax poll to get every reaction
PrimeFaces provides a lot of icons from jQuery themeroller. They're useful but I need
I've got a Primefaces command button that I need to add a callback to
I've used Primefaces multiple times. It's excellent. But this time I don't know why:
I am using primefaces datatable with clickable rows and I need to find way

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.