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 8078585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:50:27+00:00 2026-06-05T15:50:27+00:00

I have an inputText and a commandButton in a JSF page. The user inputs

  • 0

I have an inputText and a commandButton in a JSF page. The user inputs something and then gets redirected in a result page which also has has an inputText and commandButton with the same functionality. The commandButton should perform some action when clicked and redirect to a REST url (result page) which is constructed by appending the inputText value into a base URL. I tried many things but I did not manage to make this work in the second page. What I tried until now is:

  1. Inside the action of the commandButton I call my methods and then return the URL for the redirection since I have the inputText value in my bean. I used AJAX to render the commandButton on a keyup event. This works for page 1 but not for page 2. The problem is that each time a user types a letter, the button is rendered and my methods are called which I do not want as I only want to call them when the user clicks the button.

  2. I created a method in my bean in which I put all my methods. I tried both making the method PostConstruct and having an f:event with preRenderView for calling the method. Again with AJAX this does not work since the method is called each time a user types something.

  • 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-05T15:50:29+00:00Added an answer on June 5, 2026 at 3:50 pm

    The problem is that each time a user types a letter, the button is rendered and my methods are called which I do not want as I only want to call them when the user clicks the button.

    Just don’t render the button then. Perhaps you’ve used a too general client identifier in <f:ajax render> attribute like as @form. Just replace it something more specific which excludes the button.


    Again with AJAX this does not work since the method is called each time a user types something.

    Just check if it isn’t an ajax request.

    if (!FacesContext.getCurrentInstance().getPartialViewContext().isAjaxRequest()) { 
        // Not an ajax request.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which, when the button gets clicked by a user, redirects
I have jsf page: .... <form jsfc=h:form action=> <h:dataTable value=#{newMusician.strings} var=preferredMusicGenre id=musicGenresSelectTable> <h:column> <h:inputText
I have the following JSF 2.1 page <h:selectOneRadio value=#{userBean.newUser}> <f:selectItem itemValue=0 itemLabel=new User />
I have a page start.jsf which points to an action #{ruler.start}, this action forwards
In JSF + RichFaces, I have an inputText and a button, How can I
I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
I have a form in which there is a selectbox, and a inputtext field
i am new to JSF. i have a problem with tag my .jsp page
I have a JSF2 application and a page with the following code: <h:inputText id=someInput
I have a JSF 2.0 page that I want to allow a GET parameter

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.