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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:21:18+00:00 2026-05-28T03:21:18+00:00

When I hit the commandButton it puts in the value that product.amount started as

  • 0

When I hit the commandButton it puts in the value that product.amount started as rather than what is currently typed in the input box.

<h:inputText value="#{product.amount}" />
<h:commandButton id="Button"
                 value="Buy"
                 tabindex="2" >
    <f:ajax listener="#{shopBean.addToCart(product.product, product.amount)}" 
            execute="@this" 
            render="@all" />            
</h:commandButton>
  • 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-28T03:21:18+00:00Added an answer on May 28, 2026 at 3:21 am

    You need to include the input field in the execute attribute of the <f:ajax> so that it get processed as well, otherwise it will simply be ignored altogether.

    <h:inputText id="amount" ... />
    <h:commandButton ...>
        <f:ajax execute="@this amount" ... />
    </h:commandButton>
    

    Or just put the whole in a single form and use execute="@form".

    <h:form>
        <h:inputText ... />
        <h:commandButton ...>
            <f:ajax execute="@form" ... />
        </h:commandButton>
    </h:form>
    

    By the way, the render="@all" defeats one of the main advantages of using ajax. Try to render exactly only the component(s) which actually needs to be updated.

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

Sidebar

Related Questions

JSF view code: <f:view> <h:form> <h:panelGrid> <h:inputText id=key value=#{myManagedBean.key}/> <h:selectBooleanCheckbox id=rerun value=#{myManagedBean.rerun} rendered=#{myManagedBean.displayRerun}/> <h:commandButton
I want to be able to disable the commandbutton below once it's hit and
I hit the maximum url-patterns that one can have in the web.xml and I
I think I've hit that paralysis by analysis state. I have an MVC app,
A puzzle that hit me. In some simple test harness code, if I stream
Here is what I have <h:inputTextarea id=comment rows=3 cols=50 value=#{bean.comment} /><br/> <p:commandButton value=Comment actionListener=#{bean.postMessage}
I hit this error while my web application was trying to execute a SELECT
I hit Linux's 32,000 subdirectory limit. It caused problems with my PHP scripts and
I hit control + Scroll lock, control + break, and control + every other
Is there a performance hit if we use a loop instead of recursion or

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.