Hello, 
I am a newbie learning JSF while trying to meet deadlines on a JSF
refactoring project. 
The docs & forums  have helped me quite a lot.... untill now when I seem to
be facing 
a wierd problem. Here is the context : I have a dataTable and a commandLink
on every
line. The actionListener associated with this commandLink should only update
some db information
for the concerned record(and then redisplay the same page again).
My problem is that when i click on _one_ link the actionListener is called
for every link from the dataTable.
It is just like had clicked _all_ the links!! very weird.
(If I have 30 links displayed, I click one link and the actionListener is
called 30 times.. for 
all 30 rows) 

Environement : 
        app server : WebLogic 8.1 SP4  
        jsf implementation : SUN RI 1.1
  tomahawk version : 1.1.1 (the only one working with weblogic 8.1)

---THE VIEW---
#################################################adminLogging.jsp##################
 
<h:form id="displayLogForm">
    <t:dataTable id="logs"
                value="#{logSort.loggers}"
                var="log"
                binding="#{logSort.dataTable}"
                sortColumn="#{logSort.sort}"
                sortAscending="#{ logSort.ascending}"
                preserveSort="true"
     >
    <h:column>
              <f:facet name="header">
               <t:commandSortHeader columnName="loggerName" arrow="true"  >
                    <h:outputText value="LoggerName" />
               </t:commandSortHeader>
             </f:facet>
           <h:outputText value="#{log.loggerName }" />
        </h:column>
               
        <h:column>
            <f:facet name="header">
               <h:outputText value="Change Log Level" />
            </f:facet>
        <h:commandLink  value="Debug3"
actionListener="#{logSort.modifyLogOnServer3}"/>
        </h:column>            
     </t:dataTable>
</h:form>
 
##################################################################################


---BACKING BEAN---
public class LogSortHelper extends SortableList{

private HtmlDataTable dataTable;
....
    public void modifyLogOnServer3(javax.faces.event.ActionEvent event) {
 
         LoggerBean row = (LoggerBean) dataTable.getRowData();
        String attributeName = row.getLoggerName();
        logger.debug("atribute Name:"+attributeName+"|");    
    }
...
}

---LOGGERBEAN---
public class LoggerBean {
...
private String loggerName ;
....
}


in faces-config.xml, logSort = LogSortHelper 



Further on , I've tryed to get rid of the component binding stuff... (which
in fact I only needed
for the dataTable.getRowData() method) .

So i did the following modifications : 
(http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters)

---VIEW---
        <h:commandLink  value="Debug3"
actionListener="#{logSort.modifyLogOnServer4}">
                                <f:param name="logDebugId" 
value="#{log.loggerName}"/>
  </h:commandLink>
   

---BACKING BEAN---

public String modifyLogOnServer4(javax.faces.event.ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance(); 
Map map = context.getExternalContext().getRequestParameterMap();
String attributeName = (String) map.get("logDebugId");
}

Now I have my actionListener called 30 times... but for the same link( not
anymore for all the links
in the dataTable, but for the same link...  30 times)


And then something else : I am having inconsistent behaviour when changing
from commandButton to commandLink...  
IE : using commandButton my parameter is not passed to the backing
bean.(with commandLink I see params
in the backing bean)

Anybody got any solutions?

Regards, 
Radu Milos

  
  
-- 
View this message in context: 
http://www.nabble.com/CommandLink-in-dataTabl-tf4370964.html#a12458281
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to