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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:34:44+00:00 2026-06-09T02:34:44+00:00

I have the main page with includes testcomponent1 which inturn includes testcomponent2. Ajax call

  • 0

I have the main page with includes testcomponent1 which inturn includes testcomponent2. Ajax call is in testcomponent2. The call is intiated in the javascript but never hits the controller. If the ajax call is moved into testcomponent1, it triggers the call and makes it to the controller. I am including the test code for your reference.

TESTCONTROLLER:

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.AjaxBehaviorEvent;

@ManagedBean
@ViewScoped
public class TestController implements Serializable {
/** <code>serialVersionUID</code> */
private static final long serialVersionUID = -999213365169849345L;

private int customerkey;

private String customerName;

public void processKeyChange(AjaxBehaviorEvent e){
    System.out.println("I am in the Ajax method and my value is: " + customerkey);
}

//GETTERS AND SETTERS
public int getCustomerkey() {
    return customerkey;
}
public void setCustomerkey(int customerkey) {
    this.customerkey = customerkey;
}
public String getCustomerName() {
    return customerName;
}
public void setCustomerName(String customerName) {
    this.customerName = customerName;
}
}

testPage.xhtml

    <ui:define name="searchCriteria">
        <h:form id="orderHeaderForm" prependId="false">

            <h:panelGroup id="orderDiv" layout="block">
                <com:testcomponent1  id="testComponent1"
                                    customerKey="#{testController.customerkey}"
                                    customerName="#{testController.customerName}"/>

            </h:panelGroup>
        </h:form>
    </ui:define>

</ui:composition>

testcomponent1.xhtml

<cc:interface>
<cc:attribute name="customerKey" type="java.lang.Integer" />
<cc:attribute name="customerName" type="java.lang.String" />
</cc:interface>

<cc:implementation>
<h:panelGroup id="#{cc.clientId}" layout="block">
    <com:testcomponent2 id="testcomponent2" 
                key="#{cc.attrs.customerKey}"
                name="#{cc.attrs.customerName}" />

</h:panelGroup>
</cc:implementation>

testcomponent2.xhtml

<cc:implementation>
<h:panelGrid id="#{cc.clientId}" columns="2" border="0" cellspacing="0"     cellpadding="0">
    <h:outputLabel id="customerid" for="txtcustomerKey"/>
    <h:inputText id="txtcustomerKey" value="#{cc.attrs.key}" onchange="alert (document.getElementById(this.id).value)">
        <f:ajax event="change" listener="#{testController.processKeyChange}" execute="@this" render="txtCustomerName" />
    </h:inputText>
    <h:outputLabel id="customerName" for="txtCustomerName"/>
    <h:outputText value="#{cc.attrs.name}" id="txtCustomerName" />
</h:panelGrid>

</cc:implementation>

thanks

  • 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-09T02:34:45+00:00Added an answer on June 9, 2026 at 2:34 am

    I think the problem is in <h:panelGrid id="#{cc.clientId}"...>. By default, a composite component is an instance of UINamingContainer, so instead do that, you can set an id with any name and use it. A good practice is avoid EL expressions in id field.

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

Sidebar

Related Questions

On my main page I have this jquery code which does an ajax call
So I have a main JSP index page, index.jsp, which has several includes. Something
I have a main web page (Base Page) that makes an ajax call (using
I have an PHP/HTML main page, in which I include different other PHP files
I have a main page from where I am making a call to load
I have a page (main.php) which loads content from an external PHP file (rpc.php).
I have a formula @InitVars in the page header which includes the following, and
I have a index.php page that is the main page. All pages are included
I am using jQuery for a simple website and have a main page 'index.html'
I have in the main page with two principal parts : in the left

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.