Command Buttons in DataTable

Hello ,
I have a page which searches all my clients accrding to some criteria, and results are shown in a table(see code bellow please ) for each row I have one CommandButton which in theory should navigate to another page , and edit the details of each client .
<h:form>
<rich:dataTable id="prospectoTable" value="#{SearchProspecto.prospectoItems}"
                var="prospecto" rowKeyVar="index"
                onRowMouseOver="this.style.backgroundColor='#FFE4E1'"
                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" >
    <h:column>
        <f:facet name="header">
            <h:outputText  value="#" />
        </f:facet>
        <h:outputText value="#{index+1}" />
    </h:column>
    <h:column>
        <f:facet name="header">
            <h:outputText  value="Identificacion" />
        </f:facet>
        <h:outputText value="#{prospecto.identificacion}" />
    </h:column>
    <h:column>
        <f:facet name="header">
            <h:outputText  value="Id Alterna" />
        </f:facet>
        <h:outputText value="#{prospecto.idAlterna}" />
    </h:column>
    <h:column>
        <f:facet name="header">
            <h:outputText  value="Nombre" />
        </f:facet>           
        <h:outputText value="#{prospecto.fullName}" />
    </h:column>
    <h:column>
        <f:facet name="header">
            <h:outputText  value="Estado" />
        </f:facet>           
        <h:outputText value="#{prospecto.status}" />
    </h:column>
    <h:column>
            <h:commandButton immediate="true" value="Editar" action="#{SearchProspecto.editar}"  >
                <f:setPropertyActionListener value="#{prospecto.id}" target="#{SearchProspecto.prospectoIdSelected}" />               
            </h:commandButton>
    </h:column>
    <%--
    <rich:componentControl  event="onRowDblClick" for="propectoDetails" operation="show">
        <f:param value="#{prospecto.id}" name="prospectoId" />
    </rich:componentControl>
    --%>
</rich:dataTable>
</h:form>The issue I have right now it is that backing bean code, gets called but navigation does not occur:
This is my backing bean code:
public String editar() throws NamingException, SQLException {
        System.out.println("prospecto_id="+prospectoIdSelected);
        Prospecto prospecto = Prospecto.getProspectoById(prospectoIdSelected);
        FacesUtil.setRequestMapValue("prospecto", prospecto);
        if (prospecto.getTipoCliente() == 1) {
            System.out.println("editar_empresarial");
            return "editar_empresarial";
        } else {
            System.out.println("editar_individual");
            return "editar_individual";
    }and my navigation rules in faces-config.xml:
<navigation-rule>
        <from-view-id>/Prospectacion/searchProspecto.jsp</from-view-id>
        <navigation-case>
            <from-outcome>editar_empresarial</from-outcome>
            <to-view-id>/Prospectacion/editProspecto_e.jsp</to-view-id>           
        </navigation-case>
        <navigation-case>
            <from-outcome>editar_individual</from-outcome>
            <to-view-id>/Prospectacion/editProspecto_i.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>So my question is :
*1. Is it a bug ? why navigation does not occur ( action method gets invoked though) ?*
*2. I have to keep the bean in session scope , if use request scope, commadButton wont work (even action method wont be invoked) Why ? I have seen in old post ..this is a bug...but I am using SUN JSF Implementation 1.2 ....Does it still persist ?* since search could be very big...I dont want to save that in session
My software is :
JBOSS 4.2.2GA
JSF 1.2
JDK 1.6
Edited by: deibys on Jan 25, 2008 6:10 AM

deibys wrote:
*1. Is it a bug ? why navigation does not occur ( action method gets invoked though) ?*Either the view ID's or the outcome of the navigation case is simply invalid. Hint: it has to be covered by the FacesServlet mapping.
*2. I have to keep the bean in session scope , if use request scope, commadButton wont work (even action method wont be invoked) Why ? I have seen in old post ..this is a bug...but I am using SUN JSF Implementation 1.2 ....Does it still persist ?* since search could be very big...I dont want to save that in session That is certainly not a bug, but just unawareness of the JSF lifecycle. A new request means new initial data. In case of datatables, make sure that the datamodel is exactly the same in the next request. Otherwise move the datamodel to a session scoped bean and inject it in the request scoped bean.

Similar Messages

  • Problem with buttons in datatable header

    Hi
    I have command buttons in the datatable header .When I display the data in columns there is a gap between buttons .I want the buttons should be stretched automatically along with column data there should not be no gap between buttons regardless how big the data is in each column.
    Can anybody help me asap.
    Thanks.

    This issue is that the second header is an instance of the first, so all unmanaged relative code breaks. I would hazzard a guess to say that your add code looks like "$.parent.row1.instanceManager.addInstance(1)." This will break, as the "second" header row no longer sees the 'table' element as it's parent.
    Changing to code to a static reference will fix it... i.e. xfa.form.form1.table1.row1.instanceManager.addInstance(1).
    This should solve it for you... if not, let me know.
    - Scott

  • 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.

  • Jsf command button

    hi
    i have a command button as
    <f:view>
    <html>
    <body>
    <h:form id="form1">
    <h:outputText value="BuyerId :" />
         <h:selectOneMenu id="buyerid" value = "#{findprg.buyerid}" onchange = 'buyerOnChange()'>
    <f:selectItems value="#{global.buyersList}" />
    </h:selectOneMenu>
    <h:outputText value="Department :" />
    <h:selectOneMenu id='departmentid' value="#{findprg.deptid}">
    <f:selectItems value="#{global.departmentList}" />
    </h:selectOneMenu>
    <h:commandButton value="Find Program" action="#{findprg.loadData}"/>
    <h:dataTable value="#{findprg.programList}" var="row" border="1" cellspacing="1">
    <h:column><f:facet name="header"><h:outputText value = "programId"/></f:facet><h:outputText value="#{row.programId}"/></h:column>
    <h:column><f:facet name="header"><h:outputText value = "programName"/></f:facet><h:outputText value="#{row.programName}"/></h:column>
    <h:column><f:facet name="header"><h:outputText value = "buyerId"/></f:facet><h:outputText value="#{row.buyerId}"/></h:column>
    <h:column><f:facet name="header"><h:outputText value = "departmentId"/></f:facet><h:outputText value="#{row.departmentId}"/></h:column>
    </h:dataTable>
    </h:form>
    </body>
    </html>
    </f:view>
    Web.xml
    <managed-bean>
    <managed-bean-name>findprg</managed-bean-name>
    <managed-bean-class>com.poc.backingBean.FindProgram</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    My bean is
    public class FindProgram {
         private List<Program> programList = new ArrayList<Program>();
         private int buyerid;
         private int deptid;
         private int seasonid;
         private int brandid;
         private int classid;
         public String loadData() {
              System.out.println("Entering");
              DefineProgramMaintenanceFacade defineprogramfacade = AsConnector.getProgramMaintanenceFacadeBean();
              programList = defineprogramfacade.getProgramList(buyerid,deptid);
              System.out.println("exit");
              return null;
    But the method loadData is not called
    can anyone help me in this regard?
    Regards

    There may be a validation or conversion error occurred. Add <h:messages /> to the page to take note of them. Since JSF RI 1.2 it should also be logged to the stdout, read the application server logs.

  • JSP Data table - Rendering for command buttons.

    Hi All,
    We are designing a JSP page where results from table have to be thrown on a data table. (h:dataTable)
    Based on one column value on the data table, we need to render a command button for each row of data table.
    For example, I select the employees from a table and throw it on data table.
    Only for those employees where address is not present, I need to enable an "Update address" command button.
    (Command button "Update address" is also part of data table.)
    Is it possible to accomplish this on a data table?
    If so how should we code the "rendered" tag of the command button in data table.
    Any help would be greatly appreciated.
    Thanks.

    Sounds like the JSF forum would be a closer alignment, but in general
    - retrieve your information from the database into a list of Employee beans.
    - Have your h:dataTable use the list of Employee beans as a datasource
    - have the rendered attribute of your update button depend on the value of employee.address maybe #{empty employee.address}
    cheers,
    evnafets

  • Composite clients:  include command button inside data table

    Directly placing the command button into the datatable does work. However, I'd like to move it outside to another file and then include it. What's the best approach, to use ui:include? Is there a better approach?
    I'd like to have datatable.xhmtl and deletebutton.xhtml
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    template="./beatlesTemplate.xhtml">
        <ui:define name="content">
            <h:dataTable value="#{beatles.list}"  var="beatle">
                <h:column>
                    <ui:include src="deleteButton.xhtml"/>
                </h:column>
                <h:column>
                     <h:commandButton id = "btnn" value="new row" actionListener="#{pc_Test.newRow}" />
                </h:column>
                <h:column>
                    <h:outputText value="#{beatle.title}"/>
                </h:column>
                <h:column>
                    <h:outputText value="#{beatle.comments}"/>
                </h:column>
            </h:dataTable>
        </ui:define>
    </ui:composition>
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    template="./beatlesTemplate.xhtml">
        <ui:define name="deleteButton">
            <h:commandButton id = "btnn" value="new row" actionListener="#{pc_Test.newRow}" />
        </ui:define>
    </ui:composition>

    RaymondDeCampo wrote:
    Your approach seems reasonable, did it work when you tried it?No, it didn't. Pardon, I don't have more information on that, but will come back to the topic later (probably on the mailing list, which I prefer.)

  • Command button remains disabled after a request redirect to a PDF Servlet

    Hi All,
    I've a command button to generate PDF on the fly and used to work in JDev 10.1.3.3.
    When we migrated to 11g, it works for the first time on a page, and the file Open/Save dialog will come up.
    But then the command button remains grayed out, and clicking doesn't generate a server call.
    If I do something on the page which does a partial or full submit, then the button will get enabled again.
    Any suggestions?
    Thanks,
    Jaimon
    Sample code:
    Facelets:
    <af:commandButton text="Create PDF" action="#{fs02.createPDF}" />
    Java:
    public String createPDF() {
    //Validation checks here. If there are any errors, it gets added to FacesMessages to display on the same page.
    if(!validate()) {
    //sf.addInfoMessage('message here..');
    }else {
    FacesContext ctx = FacesContext.getCurrentInstance();
    HttpServletRequest request = (HttpServletRequest)ctx.getExternalContext().getRequest();
    HttpServletResponse response = (HttpServletResponse)ctx.getExternalContext().getResponse();
    RequestDispatcher rd = request.getRequestDispatcher("/pdfdownloader");
    rd.forward(request, response);
    ctx.responseComplete();
    return null;
    pdfdownloader is mapped as a servlet, which writes the actual PDF content as a stream.

    Herewith the code which is triggered with the post-forms-commit trg. As far as I can see it, there is no code to disable/enable the save button in the menubar.
    ===
    PROCEDURE validate_enbr_records IS
    CURSOR c_enbr
    IS
    SELECT exlb.exlb_length
    , enbr.enbr_ind_break
    FROM dog_envelop_breaks enbr
    , dog_extrnl_labels exlb
    WHERE enbr_appl_cod = :flow_appl_cod
    AND enbr_flow_cod = :flow_cod
    AND enbr_sort_seqnr <> :enbr_sort_seqnr
    AND enbr_appl_cod = exlb_appl_cod
    AND enbr_exlb_cod = exlb_cod;
    CURSOR c_exlb
    IS
    SELECT exlb_length
    FROM dog_extrnl_labels
    WHERE exlb_appl_cod = :flow_appl_cod
    AND exlb_cod = :enbr_exlb_cod;
    l_lengte_break_label NUMBER := 0;
    l_lengte_sort_label NUMBER := 0;
    l_length NUMBER := 0;
    l_aant NUMBER := 0;
    r_enbr c_enbr%ROWTYPE;
    mi_id MenuItem;
    BEGIN
    FOR r_enbr in c_enbr LOOP
    IF r_enbr.enbr_ind_break = 'Y'
    THEN
    l_lengte_break_label := l_lengte_break_label + r_enbr.exlb_length;
    ELSE
    l_lengte_sort_label := l_lengte_sort_label + r_enbr.exlb_length;
    END IF;
    l_aant := l_aant + 1;
    END LOOP;
    OPEN c_exlb;
    FETCH c_exlb INTO l_length;
    CLOSE c_exlb;
    IF :enbr_ind_break = 'Y' THEN
    l_lengte_break_label := l_lengte_break_label + l_length;
    ELSE
    l_lengte_sort_label := l_lengte_sort_label + l_length;
    END IF;
    IF l_lengte_break_label > 48
    THEN
    qms$errors.show_message('DOG-10194');
    END IF;
    IF l_lengte_sort_label > 50
    THEN
    qms$errors.show_message('DOG-10195');
    --set_record_property(3,'enbr',status,changed_status);
    END IF;
    IF :system.record_status = 'CHANGED' THEN
    set_menu_item_property('FILE_MENU.SAVE',ENABLED,'YES');
    END IF;
    END;
    ===
    After the message has been throughn and the OK-button has been clicked, the code is never reaching the code:
    IF :system.record_status = 'CHANGED' THEN
    set_menu_item_property('FILE_MENU.SAVE',ENABLED,'YES');
    END IF;
    The save-button remains disabled.
    Best regards
    John.

  • I just statred Flash CC for the first time and it seems that the text within the pop-up window (dialog box) is mis-aligned and not allowing me access to the command buttons, nor all the text. (ie: the NEW Template Box, can't see but 2/3 of the content)

    I just statred Flash CC for the first time and it seems that the text within the pop-up window (dialog box) is mis-aligned and not allowing me access to the command buttons, nor all the text. (ie: the NEW Template Box, can't see but 2/3 of the content) is there a fix to this problem? using 8.1, Monitor is a high res.2560x1440.

    Another View.
    the GUI is so hard to read (so small) I enlarge my Ps UI by the instructions below...which helped a lot.

  • I am attempting to upload multiple photos on a macpro from a cd.  I am used to a pc.  I tried using the command button to select multiples but it does not work.  Please advise

    I am attempting to upload multiple photos on a mac pro from a cd.  I have tried holding the "command"button down to select multiple photos but it does not work.  Please advise.  Thanks,John

    why not sort by (name, date, etc) and Click on 1st and Shift-Click on last.
    Might work better to copy or import to a project folder.
    https://discussions.apple.com/community/ilife/iphoto
    http://www.apple.com/support/iphoto

  • How to open new browser window on click of command button

    Hi,
    We have a requirement to open an image in new window when a command button is clicked. Is there any sample explaining how to do that?
    Thanks in Advance,
    Pradeep

    Hi,
    I have to load an applet viewer in the new browser window. I have URL to the PDF.
    I ma able to load the applet viewer in new browser window using javascript. But I have to load the new PDF if the same window in already opened.
    The issue here is , i am loosing the window handle if the parent page is refreshed. I want to store the window handle in session scope variable and use the same.
    How do i update the session scope variable using javascript?
    Thanks and Regards,
    Pradeep

  • Adf faces command button, bindings and ejb 3.0 persisting problem

    When mapping the persist method to an adf command button it got this error:
    1. JBO-29000: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    2. java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    Is that because Departments are serialized by the container when the session bean is accessed by the data control to catch the data when the form is populating and entities are detached from the persisting context ? or something else ?
    I bind the button to the current row data provider for the departments. Is it correct, isn't ?

    When mapping the persist method to an adf command button it got this error:
    1. JBO-29000: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    2. java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21.; nested exception is: java.lang.IllegalArgumentException: PERSIST impossible sur l'objet détaché : hr.entity.Departments@1b21. -
    Is that because Departments are serialized by the container when the session bean is accessed by the data control to catch the data when the form is populating and entities are detached from the persisting context ? or something else ?
    I bind the button to the current row data provider for the departments. Is it correct, isn't ?

  • How to open an pdf report On click of some command button in adf

    Hi,
    I have to generate some pdf report or some pdf document on click of some command button .Could any one please tell me how to achieve this.
    suggestion would be appreciated,
    Regards
    Vinay kumar

    So what you're saying is the PDF already exists on your web server, and all you want to do is navigate in the browser from your ADF application to the PDF, yes? If that's correct, let's assume you're PDF exists at:
    http://www.acme.com/someCustomPath/myFantasticReport.pdf
    Consider the <af:goButton> or <af:goLink> controls, which include the destination attribute. As such you'd do something like this:
    <af:goButton destination="http://www.acme.com/someCustomPath/myFantasticReport.pdf"/>As you can see the "go" controls are for navigating to resources not inside your ADF application, while the "command" controls are reserved for navigation among resources in your application.
    In order to generate the destination URL, just replace the destination attribute with an EL expression that retrieves it's value from a backing bean:
    <af:goButton destination="#{myBean.giveMeTheUrl}"/>Regards,
    CM.

  • I want to create a command button for my Numbers spreadsheet.

    I am creating a Numbers spreadsheet and need to have a command button. It is really simple in Excel so I assume Numbers would be too.
    Please advise.
    Thanks,
    Hank

    A88,
    I've linked your second post of this question to this thread, where the discussion has already started.
    Next step would be to respond to Watne's question:
    "Can you describe what you are trying to do so we can suggest a solution?"
    Regards,
    Barry

  • Trying to change the text of the command button.

    Hi.,
    Am using jdeveloper 11.1.1.6.,
    I have dragged and dropped a command button in my jsff page.
    When there is no record in my VO which dragged and dropped as a af:form the button will act as a create insert so that the text of the button should also be create Insert. If there is record the button should act as a update so that the text should also be update. I have used the follwoing code to change the text accordingly.
        public void settext(ActionEvent actionEvent) {
            // Add event code here...
            BindingContainer bc = getBindings();
            DCIteratorBinding dcIter =
                (DCIteratorBinding)bc.get("EssEeoDemInfView1Iterator");
            int e = (int)dcIter.getEstimatedRowCount();
            System.out.println (e);
            if ((e == 0)) {
                myButton.setText("CreateInsert");    // Null pointer exception occurs
            } else {
                myButton.setText("Update");  //null pointer exception occurs
        }Can any one pls help me?

    Hi Timo!
    This was the thing which i have did.
    I have dragged and dropped a command button to my jsff page.
    When i press the button a popup will show which ask the confirmation from the user.
    This is the code which i have written in my managed bean.
        public String delete_action() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("Delete");
            Object result = operationBinding.execute();
            Commit();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        public void deleteItem(DialogEvent dialogEvent)
            if (dialogEvent.getOutcome() != DialogEvent.Outcome.yes)
                delete_action();
              return;
          }I have used the EL Expression in my another button which will change it property according to the values in my row.
    #{bindings.EssEeoDemInfView1Iterator.estimatedRowCount gt 0 ? 'Update':'Create Insert'}For this button i have used the following code in my managed bean.
        public String update() {
             BindingContainer bc = getBindings();
            DCIteratorBinding dcIter =
                (DCIteratorBinding)bc.get("EssEeoDemInfView1Iterator");
            int e = (int)dcIter.getEstimatedRowCount();
            if ((e == 0)) {
                  CreateInsert();
            } else {
                   Commit();
            return null;
        }When i initially delete the record the button has not been changed to createinsert it remains as update. When i press the update am getting NULL pointer exception in CreateInsert() and Commit();

  • ADF JSF 10.13 how do you reference a binding from a command button?

    I have developed the following code as a model as I am trying to utilise ADF JSF without using a database.
    I have a collection called School. This has the appropriate operations that populate the school with a number of Child. A Child simply has a firstname and a surname.
    I have generated data controls for these collections and created two JSP pages and added a navigation link as follows:
    index.jsp --> goToSchool (navigation) --> school.jsp
    I have then added a command button to the index.jsp page. When the button is then pressed the school.jsp page is displayed. This works correctly.
    I would like to override the action of the button though so that before the navigation is executed I can get a handle on the school collection and populate it so that it will be displayed on the school.jsp page.
    I have previously done this in 10.12 when I had the following setup:
    index.jsp --> getSchool (dataAction) --> school.jsp
    by overriding the getSchool dataAction.
    I have looked through the 10.13 ADF user guides and tried various different things but have not managed to successfully acheive my goal of populating the school collection when the button is pressed prior to navigating to the school.jsp page.
    I would appreciate it if you could offer any advice, and if possible let me know the recommended best practices to acheive this.
    Thanks in advance for your help
    David

    Check out the ADF Tutorial (TopLink edition) chapter 5 has a section called:
    Adding a Drilldown Link
    I think this is what you are looking for.
    http://www.oracle.com/technology/obe/ADF_tutorial_1013/ADF_tutorial.pdf

Maybe you are looking for

  • Ipad mini disabled...please help

    my daughter has disabled her ipad mini because she cannot remember her passcode......is there any way I can reset the mini so she can get in and delete the passcode?  thanks for any help you can give!

  • Oracle 11g R2 RAC on vmware

    Hi All, I have read many blogs and article about installing Oracle 11g R2 RAC on vmware. For self learning process what should be minimum configuration of hardware. Minimum physical memory will be 8 GB what is minumum processor required ( 2 Cores / 4

  • Failure while loading data from R/3 to ODS : URGENT

    Hi ! while I am loading data from R/3 to ODS it is failing with message that Error occured in data selection . But in RSA3  it is extracting data . And in another scenario besides above error , it also giving error in IDoc  Request IDoc : Application

  • I recently cut my ringtone off while visiting someone at the hospital and now can not get the ringtone to reactivate.

    has anyone had this problem?  any help is appreciated. Thanks, Wayne

  • Set a value

    Hi, How can I set a value automatically into my action class without let user see this? I explain: My View contains 3 fields: ID, Name and Number. I want that user enter the ID and the Name and when user validate I will put into "Number" field a valu