ajax4jsf
  1. ajax4jsf
  2. AJAX4JSF-11

<h:commandLink> inside <f:facet name="footer"> does not work properly.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: All

    • Issuezilla Id:
      11

      Description

      Under certain conditions, commandLink doesn’t work on the first click, while
      inside a <f:facet name="footer"> but works fine outside of a facet.
      When a <h:inputText> with a <a4j:support> sub element is modified and command
      link inside facet is pressed first time, action is not called, but the second
      time it works fine.
      I am using JSF 1.2 RI with Facelets.
      Following is a page code:

      <?xml version="1.0" encoding="ISO-8859-1" ?>

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
      <%@ taglib uri="http://java.sun.com/jsf/facelets" prefix="ui" %>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">

      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>

      <body>

      <ui:composition template="/template.xhtml">
      <ui:param name="focusId" value="monthlyPassPrice" />

      <ui:define name="title_text">
      Fair Calculator
      </ui:define>

      <ui:define name="body">
      <h:messages styleClass="errorMessage" infoClass="infoMessage"
      showSummary="true" showDetail="true" globalOnly="false" />

      <h:form id="fairCalculatorForm" prependId="false">

      <h:panelGrid id="page1Grid" columns="4" width="100%"
      columnClasses="panelLabelColumn,panelDataColumn">
      <h:outputLabel id="monthlyPassPriceLabel" for="monthlyPassPrice"
      value="Monthly pass price:" title="Price of a monthly path" />
      <h:panelGroup>
      <h:inputText id="monthlyPassPrice"
      value="#

      {fairCalculatorBean.monthlyPassPrice}

      " title="Enter price of a monthly
      path" size="6" required="true" requiredMessage="Please enter price of a monthly
      pass" />
      <h:message for="monthlyPassPrice" errorClass="errorMessage"
      infoClass="infoMessage" />
      </h:panelGroup>

      <h:outputLabel id="startDateLabel" for="startDate" value="Start date:"
      title="Enter start date (mm/dd/yyyy)" />
      <h:panelGroup>
      <h:inputText id="startDate" value="#

      {fairCalculatorBean.startDate}

      "
      title="Enter start date (mm/dd/yyyy)" size="10" required="true">
      <f:converter converterId="bmgch.dateNoTimeConverter" />
      <a4j:support id="startDateAjax" event="onchange" reRender="workDays"
      requestDelay="30" />
      </h:inputText>
      <h:message for="startDate" errorClass="errorMessage"
      infoClass="infoMessage" />
      </h:panelGroup>

      <h:outputLabel id="holidaysLabel" for="holidays" value="Holidays:"
      title="Number of holidays in the time period" />
      <h:inputText id="holidays" value="#

      {fairCalculatorBean.holidays}

      "
      title="Enter number of holidays in the time period" size="1">
      <f:validateLongRange minimum="0" maximum="31" />
      <a4j:support id="holidaysAjax" event="onkeyup" reRender="workDays"
      requestDelay="30" />
      </h:inputText>

      <h:outputLabel id="workDaysLabel" for="workDays" value="Work days:"
      title="Number of work days in the time period" />
      <h:outputText id="workDays" value="#

      {fairCalculatorBean.workDays}

      "
      title="Number of work days in the time period" />

      <h:outputLabel id="ticketPriceLabel" for="ticketPrice" value="Ticket(s)
      price:" title="Enter ticket(s) price" />
      <h:inputText id="ticketPrice" value="#

      {fairCalculatorBean.ticketPrice}

      "
      title="Enter ticket(s) price" size="6">
      <a4j:support id="ticketPriceAjax" event="onchange"
      reRender="oneTicketPrice" />
      </h:inputText>

      <h:outputLabel id="numberOfTicketsLabel" for="numberOfTickets"
      value="Number of tickets:" title="Enter number of tickets" />
      <h:inputText id="numberOfTickets"
      value="#

      {fairCalculatorBean.numberOfTickets}

      " title="Enter number of tickets"
      size="6">
      </h:inputText>

      <h:outputLabel id="oneTicketPriceLabel" for="oneTicketPrice" value="One
      ticket:" />
      <h:outputText id="oneTicketPrice" value="#

      {fairCalculatorBean.oneTicketPrice}

      ">
      <f:convertNumber type="currency"/>
      </h:outputText>

      <h:panelGroup />
      <h:panelGroup />

      <h:outputLabel id="monthlyPricePerTripLabel" for="monthlyPricePerTrip"
      value="Price per trip:" />
      <h:outputText id="monthlyPricePerTrip"
      value="#

      {fairCalculatorBean.monthlyPricePerTrip}

      ">
      <f:convertNumber type="currency"/>
      </h:outputText>

      <h:panelGroup />
      <h:commandLink id="calculateFairButton2"
      action="#

      {fairCalculatorBean.calculateFair}" value="Calculate" />

      <f:facet name="footer">
      <h:commandLink id="calculateFairButton"
      action="#{fairCalculatorBean.calculateFair}

      " value="Calculate AJAX" />
      </f:facet>

      </h:panelGrid>
      </h:form>

      </ui:define>

      </ui:composition>

      </body>
      </html>

      Here is template’s code:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
      <%@ taglib uri="http://java.sun.com/jsf/facelets" prefix="ui" %>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>

      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">

      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title><ui:insert name="title_text">BMG Columbia House Sample Facelets
      Application</ui:insert></title>
      <link rel="stylesheet" type="text/css" href="style.css" />
      <f:loadBundle basename="messages" var="msgs" />

      <script language="JavaScript" type="text/javascript">

      /**

      • Sets focus on the specified field. It is being called from the body onLoad.
      • The value of the Tiles property focusId contains the id of the element
      • that will receive focus.
        */
        function setInitialFocus(){
        var focusElementId = "# {focusId}

        ";
        var focusElement = document.getElementById(focusElementId);

      if(focusElement != null)

      { focusElement.focus(); }

      }
      </script>
      </head>

      <body onLoad="setInitialFocus();">
      <f:view>
      <a4j:page>
      <h:panelGrid columns="1" border="0" cellpadding="0" cellspacing="0"
      width="100%" id="headerMenuContentLayoutGrid" styleClass="gridClass"
      headerClass="headerClass" rowClasses="c, c" columnClasses="contentColumnClass"
      style="position:relative;top:70px;width:700px;">
      <f:facet name="header">
      <ui:insert name="title">Default Title</ui:insert>
      </f:facet>
      <ui:insert name="body">Default Body</ui:insert>
      </h:panelGrid>
      </a4j:page>
      </f:view>
      </body>

      </html>

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            ajax4jsf-issues
            Reporter:
            jgenchik
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: