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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:07:04+00:00 2026-06-05T07:07:04+00:00

I have this view: <h:form id=carlin> <h:outputText id=carlinInput value=#{userBean.model.varAjax}/> <a class=btn data-toggle=modal href=#myModal >Launch

  • 0

I have this view:

<h:form id="carlin">
    <h:outputText id="carlinInput" value="#{userBean.model.varAjax}"/>
    <a class="btn" data-toggle="modal" href="#myModal" >Launch Modal</a>
</h:form>

And I have a modal dialog that shows another form:

<h:form>
    <h:inputText value="#{userBean.model.varAjax}"/>
    <h:commandLink action="#{userBean.processPage1()}" value="Ok">
        <f:ajax render=":carlin:carlinInput" />
    </h:commandLink>
</h:form>

I need to set the value typed on the <h:inputText> and pass it as a parameter to my <h:commandLink action="#{userBean.processPage1()}" value=”OK”>`

Here is my processPage1() method:

public void processPage1(String zip) {
    this.model.varAjax = zip;
}

I have tried this:

<h:commandLink action="#{userBean.processPage1(userBean.model.varAjax)}" value="OK">

But it doesn’t work. If I pass a hardcoded value, it works:

<h:commandLink action="#{userBean.processPage1('teste')}" value="OK">

But I need to pass what the user typed on that inputText to my action method. How can I achieve this?

  • 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-05T07:07:06+00:00Added an answer on June 5, 2026 at 7:07 am

    This is not the right approach. You need to specify the client IDs of the input components which you need to process/execute by the execute attribute of <f:ajax>.

    <h:form>
        <h:inputText id="varAjax" value="#{userBean.model.varAjax}"/>
        <h:commandLink action="#{userBean.processPage1}" value="Ok">
            <f:ajax execute="varAjax" render=":carlin:carlinInput" />
        </h:commandLink>
    </h:form>
    

    This way JSF will set the model value with the submitted value.

    public void processPage1() {
        System.out.println(model.getVarAjax()); // Look, JSF has already set it.
    }
    

    An alternative is to use execute="@form" which will process the entire form and this is what you usually need in standard ajaxified buttons.

            <f:ajax execute="@form" render=":carlin:carlinInput" />
    

    Note that componenent libraries like PrimeFaces and RichFaces have already made the @form the default execute attribute, so you don’t need to explicitly specify it in their command components. In standard <f:ajax> it namely defaults to @this in command components which is indeed unintuitive.

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

Sidebar

Related Questions

In the world of MVC I have this view model... public class MyViewModel{ [Required]
I have this models: class Balanta(models.Model): data = models.DateField() class Conturi(models.Model): cont=models.PositiveIntegerField() cont_debit=models.DecimalField(default=0, max_digits=30,
I have this checkBox in my view inside a form: <g:checkBox name=myCheckbox value=${false} />
I have this this View for rendering form @using ExpertApplication.ViewModels @model IEnumerable<QuestionViewModel> @{ ViewBag.Title
I have this login form. This form is a grouped table view where the
this time it's about Ruby On Rails. I have a form in the view
I have this class: class View(object): def main_page(self, extra_placeholders = None): file = '/media/Shared/sites/www/subdomains/pypular/static/layout.tmpl'
I have this attribute in my view model: [CustomRequired, EmailRegex] [Display(Name = KeepInformedPersonMail, ResourceType
In my view I have this button: <input type=submit value=Delete disabled=disabled id=btnDelete name=btnDelete />
I have this code for Form Submit.. <input type=submit runat=server id=buttonSubmit value=Add style=width:100px; />

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.