JSF Command Link inside DataTable has to be clicked twice in order to work

I currently have a command link inside of a dataTable. However, when I go to the page and click the link nothing happens. It appears that the page is refreshed but looking at the logs nothing is done. However, if you click the same link again everything is updated properly. How do I get the command link to work properly? And, I have everything operating in the session scope.

sdgorham wrote:
No I do not have h:messages on the page. Just add it for debugging purposes. There might have been a validation or conversion error occurred which wasn't 'catched' by any h:message.
Unfortunately, upgrading to another version isn't an option at the moment. OK, I checked the MyFaces page and 1.1.5 is indeed the latest JSF 1.1 implementation.
Is there any other possible solutions that are more like a hyperlink than the command button. What exactly is causing the problem that I described?Have you tried if it works with a button or not? Only then we can be more sure about the cause of the problem.

Similar Messages

  • Command Link inside of datatable

    I have the following problem when I put a command link inside a datatable.
    The action or actionlisteners never get called. Now here is the funny thing.
    1. If I move the action link outside the datatable it works.
    2. if I change the scope of the bean to session it works
    3. if the datatable contains more than 1 row it works
    The last one tells me this is a bug.
    To test this I change the sql query to limit the result so 1 row would be returned.
    The sql query returns a CachedRowSetImpl
    I believe this is a bug.
    <h:dataTable rows="6" first="0" id="table" binding="#{event.eventdata}" value="#{event.eventdetails}" var="eventdetail">
    <h:column>
    <h:commandLink value="#{eventdetail.title}" action="#{event.resaveEventaction}" actionListener="#{event.resaveEventdetails}" id="test" >
    </h:commandLink>     
    </h:column>
    <h:column>
    </h:dataTable>

    Here is some additional information that makes this more confusing.
    The following code is used to populate the datatable
    public CachedRowSetImpl getEventdetails(){
         CachedRowSetImpl rs2 = null;
         String selectedeventmy = selectedevent;
         int rowcount = 0;
         try { 
              sql = "SELECT * FROM event where eventid='"+selectedeventmy+"' ";
              rs2 = RunQuery.mysql(sql);
              rowcount = rs2.size();
         } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         return rs2;
    where RunQuery.mysql is
    public class RunQuery {
         public static CachedRowSetImpl mysql(String sql) throws Exception {
              CachedRowSetImpl crset = null;
              InitialContext initCtx = new InitialContext();
              Context envCtx = (Context) initCtx.lookup("java:comp/env");
              try {
                   DataSource ds = (DataSource) envCtx.lookup("jdbc/associations");
                   Connection conn = null;
         Statement stmt = null;
         conn = ds.getConnection();
         stmt = conn.createStatement();
         stmt.execute(sql);
         ResultSet rs = stmt.getResultSet();
         crset = new CachedRowSetImpl();
         crset.populate(rs);
         rs.close();
         stmt.close();
         conn.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
              return crset;
    if I replace the line
    String selectedeventmy = selectedevent;
    with String selectedeventmy = "61";
    it works properly.
    selectedevent is populated from the following triggered by another action event on another page. ? The funny thing is if the result set returns more that 1 row all works ok.
    public String viewDetails(){
         System.out.println("Running view Details");
         int selectedrow = eventlist.getRowIndex();
         Object selected = eventlist.getRowData();
         Map rowdata = (Map) selected;
         selectedevent = rowdata.get("eventid").toString();
         System.out.println("Selected Event:"+selectedevent);
         outcome="eventdetails";
         return outcome;
    }

  • Command Link inside table to external website in popup window

    Hi,
    I am trying to have a command link inside a table which is on the tables id. I know that if I have control of the destination page I can use setCurrentRowKeyValue. However I do not have control of the external website. So I cannot add it into my faces-config.xml file? I have tried putting a GoLink and a GoButton but I get the following Illegal character in fragment error, when I put my destination URL in. An example of the format the URL is:
    http://www.bbc.co.uk/radio?&music=#{row.PrimaryKey}&adf=123
    Where I am adding in #{row.PrimaryKey} which is the Id of the row. I would like to have the new page opened into a pop up window if this is possible.
    I am not sure if this can be done in the backing bean or whether my approach is the correct one?
    Many Thanks
    Steve

    something like...
    <af:goLink text="#{row.PrimaryKey}"
               destination="http://www.bbc.co.uk/radio?&amp;music=#{row.PrimaryKey}&amp;adf=123"
               targetFrame="_blank"/>Regards,
    Neeraj

  • Can we use JSF Command Link as an external Link.

    Hi there,
    i am using JSF command Link.Now i had a requirement to pass those links to clients through mails. is it possible to pass those links through mail. please help me out on this since many real time applications demand these scenario.
    Regards,
    A.

    yes. that's working.. Thank you.
    Regards,
    A.

  • Styling command link inside a panel List

    Hi All,
    I have the following layout:
    PanelBox
    --panelList
    -- CommandLink
    I would like to style the command link under the panel List component. I have tried skinning the command Link component individually as well as applying styling to panel List component. Both didn't work( I haven't debugged this yet with firebug). From the skinning document, it has been mentioned that Style the root component of the command Link/Panel List. In this case, how do we style the command Link component. Basically, i would like to apply style for Link active, hover and focus.
    Thanks,
    Bala

    As far as I am aware, you would need to skin the specific component irrespective of the parent componet/root.
    For your usecase, you take look at the skinning demo application for the various skinning selectors for the command link at
    http://jdevadf.oracle.com/adf-richclient-demo/faces/components/skinningKeys/commandLink.jspx
    Thanks,
    Navaneeth

  • Command Link with Datatable doesnt work

    I had read the previosu posts stating that commandLink with the datatable will be corrected with the new version of Jsf- 1_1_01 .I installed the new version and the commandLink doesnt work inside a datatable still

    try initialising the List attached to the dataTable
    in the constructor or use an outputLink
    -DevioutputLink is similar to <href in jsp.It cannot implement the actionListener and action parameters which a commandLink does. Using a constructor for initializing is fine but when i want it to implement certain method then it creates a problem.

  • Command link inside an unordered list

    i have this code:
    <verbatim>
    < ul >
    < li >
    some text
    < /li >
    < /ul >
    </verbatim>
    now i want to add a <af:commandlink> next to the 'some text'
    is that possible?
    Message was edited by:
    sigbin.com

    or is there a way to make an unordered list using adf faces like in table layout?
    dan

  • Command link in adf pivot table

    Hi,
    I Created one View Object (WrkVOR) Based on below query
    Select Desc1,Desc2 ,Date,Sum(Amount) From populate_wrk Group by Desc1,Desc2 ,Date
    Based on View Object we created pivot table
    Rows - Desc1 ,Desc2
    Column - Date
    Amount will come under each date (Like Matrix report)
    Up to It is working fine
    i added a command link on data(Amount) when i click the command link i am getting below error
    DVT-2015 Slice 1 Exceeds boundary -3
    please help....
    Thanks
    shk

    Hi,
    the real problem of the original poster seems to be <af:commandLink text="#{row.GlobalDealId}" id="cl1" action="createMDM" immediate="true" partialSubmit="true"> having immediate set to true in which case the request goes from restore view to render response. You usually use immediate=true on a command item to cancel an action (bypassing all the other JSF lifecycle steps).
    Peter551059,
    you don't give us much information about your case. So if the problem is IE9 and you verified IE9 is supported for the version of JDeveloper you use, then - in case you have a support contract - my best advise is to file a service request and have support looking at it just in case you hit a defect that should be filed as a bug
    Frank

  • Command link display wrong

    I have a table with a commandLink nested into a column. command link display itemID.
    When I click the commandLink , it will take me to the item edit page(ADF Dialog).
    ** The problem is, Sometime I click first item in the table, command link switch to display third item
    and open pop up page to third item data.
    i develop by Toplink , JDeveloper 10.1.3.3.0, connect to Oracle10gR2 Database.
    The table in page display data from DB View.
    Code JavaServer Face address.jspx :
    <af:table value="#{bindings.findVAddressesByKey1.collectionModel}"
    var="row" rows="#{bindings.findVAddressesByKey1.rangeSize}"
    first="#{bindings.findVAddressesByKey1.rangeStart}"
    emptyText="#{bindings.findVAddressesByKey1.viewable ? 'No rows yet.' : 'Access Denied.'}"
    selectionState="#{bindings.findVAddressesByKey1.collectionModel.selectedRow}"
    selectionListener="#{bindings.findVAddressesByKey1.collectionModel.makeCurrent}"
    binding="#{backing_app_App_guaadd.table1}" id="table1"
    width="100%" partialTriggers="cmdEditaddGuaLink">
    <f:facet name="selection"/>
    <af:column sortProperty="cgFirstTName" sortable="false"
    headerText="#{res['app_guaadd.guaFirstLast']}">
    <af:outputText value="#{row.cgFirstTName} #{row.cgLastTName}"/>
    </af:column>
    <af:column sortable="false"
    headerText="#{res['appaddcus.adShareFlag']}"
    binding="#{backing_app_App_guaadd.column1}" id="column1"
    rendered="false">
    <af:outputText value="#{row.adShareFlag}"
    binding="#{backing_app_App_guaadd.outputText1}"
    id="outputText1"/>
    </af:column>
    <af:column sortProperty="adWavArea" sortable="false"
    headerText="#{res['appaddcus.adwavarea_status']}"
    rendered="false">
    <afh:tableLayout width="100%">
    <afh:rowLayout>
    <afh:cellFormat halign="center">
    <af:selectBooleanCheckbox value="#{row.ad_wav_area}"
    disabled="true"/>
    </afh:cellFormat>
    </afh:rowLayout>
    </afh:tableLayout>
    </af:column>
    <af:column headerText="#{res['appaddcus.adtype_status']}">
    <*af:commandLink* text="#{(row.adType=='C')?res['appaddcus.adtype1_status']:(row.adType=='O')?res['appaddcus.adtype2_status']:(row.adType=='R')?res['appaddcus.adtype3_status']:res['appaddcus.adtype4_status']}"
    binding="#{backing_app_App_guaadd.commandLinkEdit}"
    returnListener="#{backing_app_App_guaadd.refreshPage}"
    id="cmdEditaddGuaLink"
    useWindow="true" windowWidth="1100"
    action="#{backing_app_App_guaadd.guaEditLink_Action}">
    <af:inputHidden value="#{row.adPersonType}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdPersonType}"/>
    <af:inputHidden value="#{row.adW1Size}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdW1Size}"/>
    <af:inputHidden value="#{row.adW1Pos}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdW1Pos}"/>
    <af:inputHidden value="#{row.adF1Pos}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdF1Pos}"/>
    <af:inputHidden value="#{row.adG1Pos}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdG1Pos}"/>
    <af:inputHidden value="#{row.adP1Size}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdP1Size}"/>
    <af:inputHidden value="#{row.adType}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdType}"/>
    <af:inputHidden value="#{row.adWavArea}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdWavArea}"/>
    <af:inputHidden value="#{row.adGuaSeq}"
    binding="#{backing_app_App_guaadd.inputHiddenEditAdGuaSeq}"/>
    </af:commandLink>
    </af:column>
    <af:column sortProperty="adType" sortable="false" rendered="false"
    headerText="#{res['appaddcus.adtype_status']}">
    <af:outputText value="#{(row.adType=='C')?res['appaddcus.adtype1_status']:(row.adType=='O')?res['appaddcus.adtype2_status']:(row.adType=='R')?res['appaddcus.adtype3_status']:res['appaddcus.adtype4_status']}"/>
    </af:column>
    </af:table>
    Any help is appreciated.
    Thanks.

    I'm having same issue in JDev 10.1.3.4. When I click first item in the table to go to the detail page, command link switch to display third item. This happens only after I click on the column sorting or after createInsert new record.
    I used af:setActionListener for link from the table:
    <af:commandLink text="#{row.UsrUserid}" action="editUser">
    <af:setActionListener from="#{row.rowKeyStr}"
    to="#{processScope.requestRowKey}"/>
    </af:commandLink>
    I got the value from the detail pagedef:
    <action IterBinding="SssUsersView1Iterator" id="setCurrentRowWithKey"
    InstanceName="SSSServiceAppModuleDataControl.SssUsersView1"
    DataControl="SSSServiceAppModuleDataControl"
    RequiresUpdateModel="false" Action="96">
    <NamedData NDName="rowKey"
    NDValue="#{processScope.requestRowKey}"
    NDType="java.lang.String"/>
    </action>
    Any suggestions? Thanks.

  • Af:tree with command link

    hi experts,
    am using jdeveloper 11g version 11.1.1.5.0 - adfbc components - oracle db 10g.
    am trying some examples regards,
    af:tree with commandLink,
    here what i did:
    i achieved the af:tree with the help of some association between two tables and then i exposed in ui,
    you can see in this pics1 :
    http://www.4shared.com/photo/kGE2M1yl/pics1.html
    and then af:tree output can also seen in pics2:
    http://www.4shared.com/photo/GQTB9icb/pic2.html
    this is the code for af:tree
    <af:tree value="#{bindings.ApplBusFunSuiteView1.treeModel}"
                         var="node"
                         selectionListener="#{bindings.ApplBusFunSuiteView1.treeModel.makeCurrent}"
                         rowSelection="single" binding="#{backing_untitled1.t1}"
                         id="t1">
                  <f:facet name="nodeStamp">
                     <af:outputText value="#{node}"
                                     binding="#{backing_untitled1.ot1}" id="ot1"/>
                  </f:facet>
                </af:tree>ok thing which i did all are ok.
    but my need is :
    you may see in pics2.
    http://www.4shared.com/photo/GQTB9icb/pic2.html
    i make red mark on the on a child.
    here am going to explain my need
    in the picture you can see CRM as parent
    MKG as first child
    MKG3200 as last child.
    command link should be appeared.
    when i click that it will navigate to the corresponding page.
    for eg: if i click MKG3200 navigate to the MKG3200 page.
    how can i do this.? i need some guidance.
    sorry for my poor english.
    Edited by: Erp on Dec 1, 2011 4:34 AM

    hi am waiting for john
    retrieves the page IDhere the author get the node id.
    in my task n get the page id and navigate to it. as you said.
    http://andrejusb.blogspot.com/search/label/Tree
    thanks to andrejus and you(john)
    package view.backing;
    import java.util.Iterator;
    import java.util.List;
    import javax.el.ELContext;
    import javax.el.ExpressionFactory;
    import javax.el.MethodExpression;
    import javax.faces.application.Application;
    import javax.faces.application.FacesMessage;
    import javax.faces.context.FacesContext;
    import oracle.adf.controller.TaskFlowId;
    import oracle.adf.view.rich.component.rich.RichDocument;
    import oracle.adf.view.rich.component.rich.RichForm;
    import oracle.adf.view.rich.component.rich.data.RichTree;
    import oracle.adf.view.rich.component.rich.fragment.RichRegion;
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    import oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout;
    import oracle.adf.view.rich.component.rich.layout.RichPanelSplitter;
    import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
    import oracle.adf.view.rich.component.rich.nav.RichCommandLink;
    import oracle.adf.view.rich.component.rich.output.RichMessages;
    import oracle.jbo.Row;
    import oracle.jbo.uicli.binding.JUCtrlHierBinding;
    import oracle.jbo.uicli.binding.JUCtrlHierNodeBinding;
    import org.apache.myfaces.trinidad.component.UIXGroup;
    import org.apache.myfaces.trinidad.event.AttributeChangeEvent;
    import org.apache.myfaces.trinidad.event.SelectionEvent;
    import org.apache.myfaces.trinidad.model.CollectionModel;
    import org.apache.myfaces.trinidad.model.RowKeySet;
    import org.apache.myfaces.trinidad.model.TreeModel;
    public class Main1 {
        private RichForm f1;
        private RichDocument d1;
        private RichTree t1;
        private RichMessages m1;
        private RichCommandLink ot1;
        private String taskFlowId = "/WEB-INF/dummy-task-flow-definition.xml#dummy-task-flow-definition";
        private RichRegion r1;
        private UIXGroup g1;
        private RichCommandLink cl1;
        private RichPanelSplitter ps1;
        private RichPanelGroupLayout pgl1;
        private RichInputText it1;
        private RichCommandButton cb1;
        private String i1;
        public void setF1(RichForm f1) {
            this.f1 = f1;
        public RichForm getF1() {
            return f1;
        public void setD1(RichDocument d1) {
            this.d1 = d1;
        public RichDocument getD1() {
            return d1;
        public void setT1(RichTree t1) {
            this.t1 = t1;
        public RichTree getT1() {
            return t1;
        public void setM1(RichMessages m1) {
            this.m1 = m1;
        public RichMessages getM1() {
            return m1;
        public void setOt1(RichCommandLink ot1) {
            this.ot1 = ot1;
        public RichCommandLink getOt1() {
            return ot1;
        public TaskFlowId getDynamicTaskFlowId() {
            return TaskFlowId.parse(taskFlowId);
        public void setR1(RichRegion r1) {
            this.r1 = r1;
        public RichRegion getR1() {
            return r1;
        public String dynaminflow()
             taskFlowId = "/WEB-INF/supplier-task-flow-definition.xml#supplier-task-flow-definition";
              return null;
        public String mainflow1()
                taskFlowId = "/WEB-INF/dummy-task-flow-definition.xml#dummy-task-flow-definition";
              return null;
        public void setG1(UIXGroup g1) {
            this.g1 = g1;
        public UIXGroup getG1() {
            return g1;
        public void setCl1(RichCommandLink cl1) {
            this.cl1 = cl1;
        public RichCommandLink getCl1() {
            return cl1;
        public void setPs1(RichPanelSplitter ps1) {
            this.ps1 = ps1;
        public RichPanelSplitter getPs1() {
            return ps1;
        public void setPgl1(RichPanelGroupLayout pgl1) {
            this.pgl1 = pgl1;
        public RichPanelGroupLayout getPgl1() {
            return pgl1;
        public void setIt1(RichInputText it1) {
            this.it1 = it1;
        public RichInputText getIt1() {
            return it1;
        public void setCb1(RichCommandButton cb1) {
            this.cb1 = cb1;
        public RichCommandButton getCb1() {
            return cb1;
        public void setI1(String i1) {
            this.i1 = i1;
        public String getI1() {
            return i1;
        public String cb1_action() {
            // Add event code here...
          if(this.getI1().equalsIgnoreCase("SUP1000")  ) {
                         dynaminflow();
          else  if(this.getI1().equalsIgnoreCase("MAIN1000")  ) {
                               mainflow1();
          else{
                    FacesContext ctx = FacesContext.getCurrentInstance();
                    FacesMessage fm =
                        new FacesMessage(FacesMessage.SEVERITY_ERROR, "Page Not found",
                    ctx.addMessage(null, fm);
                    return null;
            return null;
        public void onTreeSelect(SelectionEvent selectionEvent) {
         /*   //original selection listener set by ADF
            //#{bindings.allDepartments.treeModel.makeCurrent}
            String adfSelectionListener = "#{bindings.ApplBusFunSuiteView2.treeModel.makeCurrent}";
            //make sure the default selection listener functionality is preserved.
            //you don't need to do this for multi select trees as the ADF binding
            //only supports single current row selection
            /* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
           /* FacesContext fctx = FacesContext.getCurrentInstance();
            Application application = fctx.getApplication();
            ELContext elCtx = fctx.getELContext();
            ExpressionFactory exprFactory = application.getExpressionFactory();
            MethodExpression me = null;
            me =  exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class, new Class[] { SelectionEvent.class });
            me.invoke(elCtx, new Object[] { selectionEvent });
            /* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
          //  RichTree tree = (RichTree)selectionEvent.getSource();
          //  TreeModel model = (TreeModel)tree.getValue();
            //get selected nodes
         //   RowKeySet rowKeySet = selectionEvent.getAddedSet();
         //   Iterator rksIterator = rowKeySet.iterator(); */
            //for single select configurations, thi sonly is called once
         /*   while (rksIterator.hasNext())
                List key = (List)rksIterator.next();
                JUCtrlHierBinding treeBinding = null;
                CollectionModel collectionModel = (CollectionModel)tree.getValue();
                treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
                JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
                Row rw = nodeBinding.getRow();
                System.out.println(""+nodeBinding.getRow()); */
                //print first row attribute. Note that in a tree you have to determine the node
                //type if you want to select node attributes by name and not index           
            /*    String rowType = rw.getStructureDef().getDefName();
                System.out.println(""+rw.getStructureDef().getDefName());
                if(rowType.equalsIgnoreCase("SuplrDocHdView")){
                    System.out.println("This row is a department: " + rw.getAttribute("SuphdBu"));
                else if(rowType.equalsIgnoreCase("EmployeesView")){
                 System.out.println("This row is an employee: " + rw.getAttribute("EmployeeId"));
                else{
                    System.out.println("Huh ????");
                // ... do more usefuls stuff here
            RowKeySet selection = this.getT1().getSelectedRowKeys();
            if (selection != null && selection.getSize() > 0) {
                for (Object facesTreeRowKey : selection) {
                    this.getT1().setRowKey(facesTreeRowKey);
                    JUCtrlHierNodeBinding root = (JUCtrlHierNodeBinding) this.getT1().getRowData();
                    JUCtrlHierNodeBinding node = this.getFirstChild(root);
                    while (node != null)
                        System.out.println(node.getRow().getAttribute(0));
                        if(node.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2010") )
                            dynaminflow();
                        else  if(node.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2020")  ) {
                                             mainflow1();
                        //node.getRow().remove();
                        if ( node.getChildren() != null) {    
                            node = this.getFirstChild(node);
                        } else {
                            while (this.getNextSibling(node) == null && node != root)
                                node=node.getParent();
                            if(node != root) {
                                node = this.getNextSibling(node);
                            } else {
                                node = null;
                    System.out.println(root.getRow().getAttribute(0));
                    if(root.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2010")  )
                        dynaminflow();
                    else  if(root.getRow().getAttribute(0).toString().equalsIgnoreCase("APM2020")  ) {
                                         mainflow1();
                    //root.getRow().remove();
        private JUCtrlHierNodeBinding getFirstChild(JUCtrlHierNodeBinding node) {
            if (node.getChildren() != null) {
                return (JUCtrlHierNodeBinding)node.getChildren().get(0);
            return null;
        private JUCtrlHierNodeBinding getNextSibling(JUCtrlHierNodeBinding node) {
            JUCtrlHierNodeBinding parent = node.getParent();
            int index = parent.getChildren().indexOf(node);
            index = ++index;
            if(index < parent.getChildren().size()) {
                return (JUCtrlHierNodeBinding)parent.getChildren().get(index);
            return null;       
    }i get my output. what i need.
    you must check whether am going correct?
    please suggest me.
    sorry : pulling this thread to up.

  • Command Link usage in JSF datatable

    Hi,
    Following is my requirement. Can any one help me in resolving the issue.
    I hava a JSF page which displays a datatable. One of the columns in the datatable displays a command link. When the user clicks the link in a particular row. Details correpsonding to the particular row have to be displayed in another page. I am using action attribute to perform the navigation from first page to next. Inside action method in the backing, is there any other means to get the row data from the datatable for which the link is clicked.
    Please help.

    You may find this article useful: http://balusc.blogspot.com/2006/06/using-datatables.html

  • Command Link as a row of a datatable in JSF

    Hi All,
    I am new to JSF. I have a Datatable with n number of rows.
    I would like to have a command Link in each of the rows, so that when i click the command link i should get the data of the entire row in my edit page.
    Can anyone suggest how can i achieve this.
    Regards
    SN

    Hi,
    Do following:
    1- add a datatable in your page and fill it with data comes from database(Assume u have no problem with datatable)
    2- add a column as commandLink in data table. e.g.
    <h:column>
    <f:facet name="header">
    <h:outputText value="name" />
    </f:facet>
    <t:commandLink action="editObject" immediate="true" >
    <h:outputText value="#{theobject.name}" />
    <t:updateActionListener property="#{objectForm.id}" value="#{objectDto.id}" />
    </t:commandLink>
    </h:column>
    in this code:
    "name" is header of column,
    "editObject" is defined in navigation rule to navigate to edit page, lets say object form.
    "theobject.name" the value that mouse gets finger over it!
    "objectForm.id" the pointer to an "id setter" of a managed bean (named objectForm) defined in faces-config.xml. In this setter you can load corresponding data from database
    "objectDto.id" the pointer to an "id getter" of a managed bean (named objectDto) defined in faces-config.xml. this getter return the id of the entity row you clicked on.
    3- Clearly, you need to defined all managed beans, and dont forget to have a customized setter for id of objectForm (setId) to load the entity from database and fill all editable properties(as you like) in this function (setId).
    4- you need a JSF page to redirect to it for editing properties and feed by objectForm
    5- Thats it :)

  • JSF Command Button and Command Links

    The main page of my JSF application has a Save button and Command Links. After making any changes on the main page the user should click Save before using any of the Links. Most of the time almost all users do this. However, some users are making changes then clicking a Link, thereby losing their changes.
    I could always execute my save method in the backing bean when a link is clicked, but, most of the time this would be doing a lot of processing which usually would not be necessry.
    Is their some way to check if any changes have been made and then doing the save only when necessary?
    Regards,
    Al Malin

    Anybody?
    What would be beneficial is something like this. If somehow it could be determined if any of the JSF fields on the page were modified. Then, in the backing bean method that handles the ActionEvents for the links, I would check if changes were made and, if so, call my save method.
    In other words is it possible to determine, in the backing bean, whether or not JSF fields have changed?
    Regards,
    Al Malin

  • Command links in h:datatable not working

    I have some command links in h:datatable which are not working. When I click the command link all I get is a referesh page(same page is displayed with datatable values as null). But when I put command link outside h:datatable, the navigation takes place properly. Any idea what could be worng

    You can try using t:dataTable from tomahawk.jar, instead of the h:dataTable. Make the following changes in your code.
    1. Add the taglib uri in your JSP as,
    <%@ taglib uri = "http://myfaces.apache.org/tomahawk" prefix="t" %>
    2. Add the tomahawk-1.1.3.jar to your WEB-INF/lib folder.
    3. Instead of using h:dataTable, use t:dataTable.
    4. After the form save your bean's state as,
    </h:form>
    <t:saveState id="viewForm" value="#{stateBean}"/>
    Here, id can be any name and the value should be the name of your bean, how u have used in your JSP.
    I hope this will help you.

  • Dynamic datatable and command link

    I'm having a problem creating CommandLink's automatically. What we have is a tag, which can contain a set of data. We need this on several locations, so we have to create a datatable dynamically. When you press a link, it should be possible to retrieve the ID of the component on that specific row.
    The problem is, we can create the table with the necessary data. When I construct the column with the ID (and the link), it fails.
    Code:
    HtmlCommandLink link = new HtmlCommandLink();
    Application app = FacesContext.getCurrentInstance().getApplication();
    ELContext elContext = FacesContext.getCurrentInstance().getELContext();
    ValueExpression ve = app.getExpressionFactory().createValueExpression(elContext,"${" + TABLE_VAR_NAME + "." + property + "}", Object.class);
    link.setValueExpression("value", ve);
    link.getAttributes().put("rowId", ve.getExpressionString() );
    link.addActionListener(
        new ActionListener(){
         public void processAction(ActionEvent arg0)
              throws AbortProcessingException {
              LOG.info(">>>>>>>>>>>>> Linked pushed !!"  +
              arg0.getComponent().getAttributes().get("rowId"));
    selectColumn.getChildren().add(link);
    datatable.getChildren().add(selectColumn);The rowId is always #{row.code}, instead of the actual data. Is there a way to create a command link dynamically, press it and retrieve the ID of that field? That expression should be evaluated at runtime and added to the datatable, but that doesn't happen apparently.

    I've read your article, but I didn't find anything I could use. Facing a deadline and don't really have time to try out multiple (possible) solutions. The problem is that all the examples I can find point to MethodBinding, but I don't need that. I just need to get the ID of the row that was clicked, nothing more.
    This works fine:
    link.setValueExpression("value", ve);I don't see why the other expression isn't evaluated.
    I can do getParent().getParent() to get a reference to the DataTable, but the datamodel on that object is empty btw.

Maybe you are looking for

  • Force user to select yes/no based on criteria in another field

    Hello, I have a training subform. When the user slects a course that was taken by an employee adn if the course offers a certificate (the table with the course has the yes/no value already chosen when the course was entered in a table called course l

  • Storing MPEG4 files in TV Programmes library. Is this possible?

    I have a number of TV Programmes I have recorded with a PVR. I have converted them to MP4 so I can view them with Apple TV. The Itunes library stores them as home movies by default, I would rather keep the files in the TV Programmes folder...which is

  • Make activity available only as follow-up

    Hello, is there a possibility in CRM 2007 to deactivate an activity to be created from the activities work center so that it is only available as follow-up from e.g. an opportunity? Example: There would be an activity "ZXY Follow-up opportunity" and

  • Dead lock in 11g

    Hi, How can we find the deadlocks in oracle 11g ? And how can fix them ?.

  • Serious problem with mail. Screenshots included

    I'm not sure what happened here, but I erased one email account and then all of the sudden everything got messed up. If you look at the screenshots, I think you can get a pretty good idea how its not adding up. Account names aren't even matching from