Solved

hyperlink action not calling managed bean method

Posted on 2007-04-04
3
2,743 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countAbc challenge 9 50
Java Server Faces parameter pass? 6 26
eclipse java  build path 6 25
github account with ecipse 1 20
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now