2 Replies Latest reply on Jul 7, 2008 5:35 AM by ilya_shaikovsky

    How to get value from HtmlAjaxCommandLink?

    benjes

      Hi,

      I am trying to get the 'value' of a <a4j:commandLink> in Java.

      e.g.in XHTML:

      <a4j:commandLink id="SomeID", value="SomeValue"/>


      In Java I get the component based on the id with invokeOnComponent

      context.getViewRoot().invokeOnComponent(context, clientId,
       new ContextCallback() {
       public void invokeContextCallback(FacesContext context,
       UIComponent component) {
       found = component;
       }
       });


      I thought casting that component to UICommand and calling getValue()
      on it would return 'SomeValue' but it returns null.

      How do I get the value? Any ideas?

      Thanks

      Immo

        • 1. Re: How to get value from HtmlAjaxCommandLink?
          benjes

          This is getting weirder.

          I have tested with some normal a4j:commandLinks and there it works.
          In my example I have the links as part of a dataTable and suddenly it doesn't. Does that make sense?

          <a4j:form id="#{StationListManager.formID}">
           <rich:dataTable id="#{StationListManager.tableID}"
           var="stationEntry"
           value="#{StationListManager.entryList}" rows="4"
           rendered="#{not empty StationListManager.entryList}">
           <rich:column id="ColID">
           <a4j:commandLink value="#{stationEntry.station.name}"
           onkeypress="#{stationEntry.keyHandleCommand}"
           onfocus="setStationId(#{stationEntry.station.id})"
           eventsQueue="foo" ignoreDupResponses="true"
           id="#{StationListManager.entryID}"
           action="#{stationsHome.selectStation(stationEntry.station)}"
           reRender="NowNext,VideoID,buttonBar"/>
          
           </rich:column>
          </rich:dataTable>


          • 2. Re: How to get value from HtmlAjaxCommandLink?
            ilya_shaikovsky

            for your first post.. May be it will be simplier add f:param to your link?