Error commandlink  and commandbutton

Hi.
I have a sample page whith a datatable who rows are commandlinks that (action procedure1).
I this page I have a button that re-execute a query who provide rows to datatable (action procedure2).
When I click in a row the commandlink works ok calling procedure1...
when I click in button the procedure1() is called first time, and when I click in button second time is that procedure2() is called.
<h:column binding="#{P0110.column4}" id="column4">
<h:commandLink action="#{P0110.procedure1}" binding="#{P0110.linkAction1}" id="linkAction1">
<h:outputText binding="#{P0110.outputText10}" id="outputText10" value="#{currentRow['Descricao']}"/>
</h:commandLink>
<f:facet name="header">
<h:outputText binding="#{P0110.outputText11}" id="outputText11" value="Descri��o"/>
</f:facet>
</h:column>
<h:commandButton action="#{P0110.procedure2}" binding="#{P0110.button2}" id="button2" style="left: 920px; top: 76px; position: absolute" value="Executa"/>
PS: My procedure1 call a page with "this.getExternalContext().redirect( this.getExternalContext().getRequestContextPath() + "/faces/"+NomePag+".jsp);"

Hi Runa.
this is a sample example that I create using pointbase. Please, test, that you undestand better my question.
</head>
<body style="-rave-layout: grid">
<h:form binding="#{Page1.form1}" id="form1">
<h:dataTable binding="#{Page1.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd"
style="left: 300px; top: 90px; position: absolute" value="#{Page1.dataTable1Model}" var="currentRow">
<h:column binding="#{Page1.column2}" id="column2">
<h:commandLink action="#{Page1.acionaModulo}" binding="#{Page1.linkAction1}" id="linkAction1">
<h:outputText binding="#{Page1.outputText3}" id="outputText3" value="#{currentRow['NAME']}"/>
</h:commandLink>
<f:facet name="header">
<h:outputText binding="#{Page1.outputText4}" id="outputText4" value="NAME"/>
</f:facet>
</h:column>
</h:dataTable>
<h:commandButton action="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1" style="left: 555px; top: 70px; position: absolute" value="Submit"/>
</h:form>
</body>
public Page1() {
// <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
try {
personRowSet.setDataSourceName("java:comp/env/jdbc/Travel");
personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON");
dataTable1Model.setDataCacheKey("com.sun.datacache.Page1.personRowSet");
dataTable1Model.setRowSet(personRowSet);
dataTable1Model.setSchemaName("TRAVEL");
dataTable1Model.setTableName("PERSON");
} catch (Exception e) {
log("Page1 Initialization Failure", e);
throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
// </editor-fold>
// Additional user provided initialization code
public String acionaModulo() {
try {
this.getExternalContext().redirect( this.getExternalContext().getRequestContextPath() + "/faces/page1.jsp");
catch (IOException e) {
log("P0110 acionaModulo() ", e);
error("Detail:P0110 acionaModulo(): " + e);
return null;
protected void afterRenderResponse() {
personRowSet.close();
public String button1_action() {
try {
personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON where NAME> 'B'");
dataTable1Model.execute();
} catch (Exception e) {
log("Page1 Initialization Failure", e);
throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
return null;
To make the error :
1) click in a line . You obtain an 404 error (no problem)
2) Return to page before and click in button.
3) The expected result was a new rowset because the execution of a second query, but the action is the execution of acionaModulo
Thanks.
Heitor.

Similar Messages

  • Problem with commandLink and commandButton

    Problem with commandLink and commandButton
    I have commandButton id="submit" action="{myActionClass.dothis}"
    When I click on the commandbutton it is not submiting to the action class rather, its submitting to the same page..
    I am tired of this ...
    I am using tiles for displaying jsf pages . Any problem because of using tiles

    yes I have the validator.
    If I open the url directly its working fine
    let say I am opening localhost:8080/test/test.jsf
    then it works fine
    If i use the same test.jsf along with tiles and open it, then its dispalying all the elements but when i click on commandbutton.. nothin is happening.
    the seems like page is reloaded.

  • Using commandLinks and commandButtons in dataTables

    I'm trying to create a page that displays data from a database and allows you to edit individual rows by clicking on either a commandButton or a commandLink within a dataTable that then takes you to another page where you can edit that particular row of the table.
    When using a commandButton, it works perfectly for all but the last entry in the table. But when the button in the last line is clicked, nothing happens at all, it does not seem to call the action listener and it does not perform the navigation based on the action. But with all the previous buttons it calls the actionListener and navigates perfectly. Can anyone tell me why this would be? The code is as follows:
    <h:dataTable value="#{Categories.categories}" var="category" >
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.deptColumnHead}"/></f:facet>
    <h:outputText value="#{category.departmentName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.categoriesColumnHead}"/></f:facet>
    <h:outputText value="#{category.categoriesList}"/>
    </h:column>
    <h:column>
    <h:form>
    <h:inputHidden id="dept" value="#{category.departmentId}"/>
    <h:commandButton id="editButton" action="EditCat" actionListener="#{Categories.editListener}" value="{msgs.editSelectedButtonText}"/>
    </h:form>
    </h:column>
    </h:dataTable>
    When using commandLinks, only the first one works (of 4). For the other 3 the page goes into error when the link is clicked and it complains that 'document.forms._id2:3:_id10._id2:3:_id10:idcl is null or not an object'. If anyone could tell me what is wrong with my code, i would be most appreciative.
    <h:dataTable value="#{Categories.categories}" var="category" >
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.deptColumnHead}"/></f:facet>
    <h:outputText value="#{category.departmentName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.categoriesColumnHead}"/></f:facet>
    <h:outputText value="#{category.categoriesList}"/>
    </h:column>
    <h:column>
    <h:form>
    <h:inputHidden id="dept" value="#{category.departmentId}"/>
    <h:commandLink action="EditCat" actionListener="#{Categories.editListener}">
    <h:outputText value="#{msgs.editSelectedButtonText}"/>
    </h:commandLink>
    </h:form>
    </h:column>
    </h:dataTable>

    1) I have had very odd behavior in JSF when ALL of the
    JSF elements on a page do not have an id attribute. If
    you do not assign an id then JSF will manufacture a
    unique id on the flag. Sometimes the unique id wasn't
    so unique and there were errors like you are seeing or
    just odd behavior on the form, buttons not generating
    events, or incorrect rendering, etc.
    By 'ALL' I mean output text, columns, anything that
    accepts an id attribute. Don't trust the code to
    generate an id correctly for you.Just want it known that while this may be necessary in the short-term to work around bugs, this is definitely not the intent of the EG! We don't want people getting in the habit of
    Also note that this behavior is not consistent
    sometimes it would not appear on a page unless the
    page was updated and more controls added to it.Ah, well that is a known issue; while developing a page, the Sun RI can have problems if you change a page's contents between two submissions. (It doesn't pick up that the .jsp has changed.) I'd recommend:
    - Use client-side state saving.
    - Make sure you're making a new request for a page (not re-POST-ing anything!) when the page's contents have changed.
    If you follow both of those rules, then you should generally be able to get away without explicit IDs everywhere as you actively develop your page.
    Explicit IDs are required if you're inside <c:if>; this is known and documented.
    2) try putting the hidden input control in it's own
    columnNo, that'll give you a bonus set of <td> elements, which isn't what you want.
    -- Adam Winer (EG member)

  • CommandLinks and CommandButtons in Datatable do not work

    I have read the threads about this issue and am aware of the fact that there is a problem, if the backing bean is in request scope. However, my backing bean is in session scope and it still does not work - my action methods are never called. What's more, I have another backing bean in session scope, where it works perfectly and I cannot see any difference between them.
    Here's the code, my backing bean is dms:
    <h:form rendered="#{dms.documents.rowCount > 0}">
    <h:dataTable rowClasses="..." headerClass="..." value="#{dms.documents}"
    columnClasses="..." var="item" border="1" cellpadding="2" cellspacing="0">
    <h:column>
    <f:facet name="header">
    <h:outputText>DocName</h:outputText>
    </f:facet>
    <h:commandLink action="#{dms.test}" value="#{item.docName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"/>
    <h:commandButton id="foo" value="View" action="#{dms.test}"/>
    </h:column>
    </h:dataTable>
    <h:commandLink action="#{dms.test}" value="Clickme"/>
    </h:form>
    Here is the code in the backing bean:
    public String test() {
    System.out.println("Hooray");
    return "mainPage";
    And this in faces-config.xml:
    <managed-bean>
    <managed-bean-name>dms</managed-bean-name>
    <managed-bean-class>com.mypackage.DmsController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    Only the last link, the one outside the datatable and titled "Clickme", works. I can see "Hooray" in the logfile and am redirected to the main page. If I click any of the links or buttons in the datatable, nothing is written to the log and the same page is loaded again, but only the static content is displayed, i.e. no JSF tags are evaluated, they are just dropped. There are, however, a few hidden input fields called javax.faces.ViewState, which I don't know where they are coming from.
    As I said, I have another backing bean in session scope, which is modelled exactly like that and it works there. Maybe JSF apps are supposed to have only one controller?
    Many thanks in advance for any pointers,
    Ulrich
    Edit: It doesn't change anything if I put the backing bean in application scope. I did have the same problem before with my other backing bean, but could solve it there by putting it from request scope to session scope.

    <h:dataTable value="#{dms.documents}">How do you load this list? This list should not be null during the INVOKE_APPLICATION phase.
    Try stubbing the List right in the getDocuments() method and see if it works.

  • CommandLink and Button don't work in nested form

    Hi,
    I have such a structure:
    <h:form ...>
       <h:datatable ...>
           <h:form ...>
              <h:commandButton ...>Somehow this structure corrupts the buttons and links. When I remove the inner form element, then they work properly.
    Interesting point is that not only commandLink/Buttons inside the inner form but also commandLink/Buttons outside the inner form are corrupted. There is no error message neither.
    This is not a big deal for me, cause inner form was useless. I wrote here for error documentation and curiosity. Do you know the reason of this behavior?
    Thanks...
    Mert

    Hi,
    Just see the HTML generated code and you will get your answer :-)
    In html, nested forms do not work, then nested form in jsf do not work as well.
    Hope to help.

  • CommandLink and js:confirm

    hi, i meet some problem with commandLink and js.
    jsf code:
    <h:commandLink value="Del" onclick="return delconfirm();" action="#{userAdminBean.userDel}" >
                                            <f:param name="userId" value="#{info.uid}"/>
                                            <f:param name="userPartId" value="#{info.upartmentid}"/>
                                       </h:commandLink>js code:
         <script language="javascript">
              function delconfirm(){
                   return confirm("confirm to del?");
         </script>i click the commandLink "Del", then a messagebox with two button "submit" and "cancel" will be shown.but whether i click the "submit" or "cancel", the expolre client don't send request to web server,.
    who can help me?thanks.

    sorry, i use jsf1.1.
    it works when removing the onclick part.
    i hava not used commandButton to replace commandLink, as i must pass someparameter useing f:param.
    excepting using jsf1.2 , are there any other way to solve this problem?(not using commandButton ,because i have to pass parameter)

  • I set up family sharing wrong, so i left family sharing and joined the right way agin but an error occurred and now it tells me I'll have to wait 364 days to rejoin again! How can I reset my account so I can use it again?

    WWhen I set up family sharing i did it with me as family organizer, but as my spouse is the organizer I had to leave the "family" I created and join his. But while setting it up an error occurred, and the screen went blank. Now I tried to join his family sharing again, and my phone keeps telling me I can't because accounts can only join families twice a year.
    I Don't really want to wait 364 days from now, is there a way in which I can reset my accoint so I can join family sharing again?
    Apple support doesn't have a solution for me yet!
    KInd regards

    This morning I looked at my family sharing account again an IT WORKS NOW! Think Apple has done a reset to my account, though I'm not exactly sure why! So I hope it works for you guys as well!

  • My ipod touch is not list as a device on itunes.  When I tried do update itunes, I get a ox8007054f error code and the update will not complete.

    My ipod touch is not listed as a device when connected to my computer.  As suggested I attempted to download the latest of itunes.  I got an
    ox8007054f error code and the down load will not complete.  I have also tried to restore my computer to an earlier setting, but it will
    not accept the change.

    Have you looked at this completed previos discussion. It discusses 0x8007054F.
    Re: Error message when trying to install iTunes

  • I am getting an error report and not sure how to fix the script. Please help...

    I am using action script 3. I have html codes from ccbill that I am trying to make work with flash. Here is the script I am trying to use:
    import flash.net.URLRequest;
    var url:String = 'http://www.lexiefyfe.com/ccbill9001/index.htm';
    myButton.addEventListener(MouseEvent.CLICK, onOrderClick);
    function onOrderClick():void
          var request:URLRequest = new URLRequest(url);
          try {
                navigateToURL(request, '_blank');
          } catch (e:Error) {
                trace('An error occurred');
    Here is the code from ccbill:
    <A HREF="http://www.lexiefyfe.com/ccbill9001/index.htm"><img src="ccbutton.jpg"></A>
    This is the error report I am getting:
    Scene=photogallery, layer=buttons, frame=1, Line 1 Statement must appear within on handler
    Scene=photogallery, layer=buttons, frame=1, Line 3 Statement must appear within on handler
    Scene=photogallery, layer=buttons, frame=1, Line 5 Statement must appear within on handler
    Scene=photogallery, layer=buttons, frame=1, Line 7 A type identifier is expected after the ':'.
    Scene=photogallery, layer=buttons, frame=1, Line 9 The class or interface 'flash.net.URLRequest' could not be loaded.
    Scene=photogallery, layer=buttons, frame=1, Line 7 Statement must appear within on handler
    If anyone can help me with this issue I would be most grateful.
    Thank you for any consideration,
    Thomas

    You have a mixture of things going on... AS3 code in an AS2 setting.  Those are all AS2 error messages, and they are indicating you have placed the code on the buttons.  To use that code, it must be placed on the timeline, and your Flash Publish Settings need to have AS3 specified instead of AS2.  AS3 does not allow code to be placed on objects like AS2 does.

  • I have just bought an iPhone 5 and it won't sync to iTunes.  It says it needs  iTunes 10.7, which I have downloaded and installed.  I still get the error message and looking at "about iTunes" it says 10.6.3.  What do I do??

    I have just bought an iPhone 5 and it won't sync to iTunes.  It says it needs  iTunes 10.7, which I have downloaded and installed.  I still get the error message and looking at "about iTunes" it says 10.6.3.  What do I do??

    Perhaps check to see if you're accidentally running two different versions of iTunes. There's some information on troubleshooting that in the Opening iTunes section of the following document:
    Troubleshooting iTunes installation on Mac OS X

  • HT4972 i cant update my iphone 3gs to a more newer ios? it says here error! and the phone flashes some connect to itunes.. an if i connct nothing happens.. help me.. the ipgone wont open . and work pls help me thank you!

    i cant update my iphone 3gs to a more newer ios? it says here error! and the phone flashes some connect to itunes.. an if i connct nothing happens.. help me.. the ipgone wont open . and work pls help me thank you!

    Hello AlexCornejo,
    Thanks for using Apple Support Communities.
    The screen you're seeing on your iPhone indicates it is in recovery mode.  Now since the device is not appearing in iTunes on your PC, first follow the steps in this article:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    After following those steps, you should be able to restore your iPhone.
    Take care,
    Alex H.

  • Photoshop Elements 10 will not open.  I get Error message that says "Runtime Error!" and closes.  What do I do?

    Help.  Photoshop Elements 10 will not open.  I get Error message that says "Runtime Error!" and closes. What do I do?  What does it mean?  I bought Elements 10 at a retail store.  It did work for a while.

    Hi,
    Can you post back with the following.
    1.  The full Model No. and Product No. of the notebook ( from the service tag underneath your notebook ) - see Here for a further explanation.
    2.  The full version of the operating system you are using ( ie Windows 7 32bit ).
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • So I download photoshop cc (2014) and when I go to open the program, it gives me an error message and shuts the program down. It says," A problem cause the program to stop working correctly. Windows will close the program." Can someone help me please?

    So I download photoshop cc (2014) and when I go to open the program, it gives me an error message and shuts the program down. It says," A problem cause the program to stop working correctly. Windows will close the program." Can someone help me please?

    I've got the same issue and it affects all my adobe software.  You are not alone as I have seen several postings looking for the answer to this help request.

  • When I download and install iTunes it looks it does it, but then it never starts, instead gives an error report and says iTunes encountered some problem and has to close

    When I download and install iTunes it looks it does it, but then it never starts, instead gives an error report and says iTunes encountered some problem and has to close

    i don't know how they solved it, i'm having the same problem on Windows XP
    EventType : BEX
    P1 : iTunes.exe
    P2 : 10.7.0.21
    P3 : 504d85d9
    P4 : unknown
    P5 : 0.0.0.0
    P6 : 00000000
    P7 : 08920740
    P8 : c0000005
    P9 : 00000008

  • ITunes will not open (no error message and not running Norton 2005)

    I have recently upgraded to iTunes 7 and I now cannot get it to open after clicking on the icon. The iTunes.exe process comes up in the task manager briefly then disappears. There is NO accompanying error message and I am NOT running Norton Antivirus 2005. I have already tried reinstalling the standalone version of quicktime and I have used msconfig so that I essentially have only the necessary iTunes/quicktime processes running (no antivirus/antispyware/anti-popup software is running in the background). I have Windows 2000 and I have never had a problem with iTunes until now. Somebody please help me out here.

    wapierce,
    It looks like we have covered all the bases here. Unfortunatly it looks like The computer cannot run iTunes or the OS has an issue that may require a reeinstall.
    Lets verify the Hardware and OS one more time. Click Start> right click My Computer> Properties(you can also open My Computer then click view system information on the left side of the window.) What does the processor and Memory say here? Also what is it saying aout Windows.
    Make sure there are no upadtes available for the computer.
    When you installed iTunes did you make any registry changes? It sounds like the next step would be doing a restore or re-install of Windows on the computer.
    Jason

Maybe you are looking for