Solved

hyperlink action not calling managed bean method

Posted on 2007-04-04
3
2,746 Views
Last Modified: 2013-11-24
when the page is loaded Data will be displayed from SummaryMBean managed bean;when i click hyperlink on one of the recods its not calling
loadDetails HeaderMBean managed bean.i put system.out.println in HeaderMBean constructor its not going there;why?



<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>


<body>
      <f:view>
      <h:form id="form1">
        
            
            <h:panelGrid style="width:100%" styleClass="TABLEBORDER">
              <t:dataTable var="list" rowClasses="ROW1,ROW2" border="0" cellspacing="2" cellpadding="0" width="100%" value="#{SummaryMBean.itemsList}" id="table">
                <t:column width="2%" id="column1">
                        <f:facet name="header">
                              <h:outputLabel dir="ltr" styleClass="COLHEAD"  for="info_image" style="width:100%" value=""></h:outputLabel>
                        </f:facet>
                        
                </t:column>
               
               
                <t:column width="6%" id="column2">
                        <f:facet name="header">
                              <h:outputText styleClass="COLHEAD" value="Line" />
                         </f:facet>
                           <h:outputText value="#{list.lineNo}" style="width:100%">
                        </h:outputText>
                  </t:column>
                  
                  
             
              <t:column width="6%"  id="column3" >
                        <f:facet name="header">
                              <h:outputLabel dir="ltr" styleClass="COLHEAD" for="edit_image" style="width:100%" value="">
                              </h:outputLabel>
                        </f:facet>
                        <h:commandLink       action="#{HeaderMBean.loadDetails}">
                              
                                       <h:graphicImage style="border:0px;" id="edit_image" value="edit.gif"></h:graphicImage>
                        </h:commandLink>
                                
              </t:column>
              </t:dataTable>
            </h:panelGrid>
            </h:form>
            
      </f:view>
</body>
</html>
0
Comment
Question by:chaitu chaitu
  • 2
3 Comments
 
LVL 8

Expert Comment

by:mnrz
ID: 18849111
in my experience when you click on a hyperlink and nothing happen, it seems that an exception or a problem occurs during the request lifecycle and this problem prevent request to reach to the respected managed bean.

and unfortunately, there is no exception message.

so I recommend you remove all columns, or if you have any other component in this page remove them and add them one by one, and after adding each one test to see whether it has problem or not and you will find the component cause this problem.

sometimes it is because of conversion a value in client when to the relative manage bean instance variable.

hope this help
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 18856501
In the dataTable one we mention preserveDataModel="true" then its working fine;

what  preserveDataModel will do?
0
 
LVL 8

Accepted Solution

by:
mnrz earned 500 total points
ID: 18856529
well if you read the documents of Tomahawk, it is said:

When this attribute is "true", the data behind the current DataModel is saved after the render response phase and restored in the restore component tree phase

Whenever you use a DataModel backed by a database connection you could run into problems, when the data in the database has changed since the last request. All Lifecycle phases prior to the render response phase iterate the DataModel and assume that the DataModel is unchanged since the last request. At least the row count must not have changed, because all children of UIData that are bound to the DataModel rely on it. But even if you can assure that row count never changes, a change in the data can have unintentional sideeffects.
Using the preserveDataModel feature prevents such problems. The DataModel (to be more exact: the currently visible part of the DataModel given by the first and the rows attribute) is freezed right after rendering and you can be sure that all lifecycle actions during the next request happen on exactly the same data.

you can find these in following links:

http://wiki.apache.org/myfaces/Working_With_DataTable_And_PreserveDataModel

http://myfaces.apache.org/tomahawk/extDataTable.html

But
I think it's not resolved your problem, it seems some of your data are invalid or make problem and by setting that attribute to true you just ignore the problem.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JavaScript/Java - Changing an image background color 4 67
egit plugin on eclipse 8 64
What's wrong with this code? 4 23
going to wrong jsp page 2 21
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question