JSF AJAX post-back

I have a javascript function for a POST request from XMLHttprequest object.The post-back is handled within the decode function of the component which generates the AJAX request. The javascript request looks as follows:
function lookup(field) { .... if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } var formdata = "ajaxreq=true"; " var formAction = window.document.forms[0].action;\n" + "req.open(\"POST\",formAction,true);\n" + "req.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\");\n" + req.onreadystatechange = processXMLResponse; req.send(formdata); } This request is generated from within the directoryBrowser.jsp itself. This request is not being recognized as a post-back by the JSF framework ,successful as it is not causing the decode method of the component to be executed. What is wrong? When i print out the responseText of the request object from the callback function, i get teh html of the page printed out.The responsexml is null.

Maybe, you've already solved the problem.
Anyway, I faced with a similar problem and (after days of debugging and googling) I solved it making the request object local rather than globa (and changing the request callback accordingly)l.
function sendRequest()
  var req = createRequestObject(); // e.g. new XMLHttpRequest();
  req.open('GET', url, true);
  req.onreadystatechange = function{ handleRequest(req); };
  req.send(null);
function handleRequest(req)
  if (req.readyState == 4)
    if (req.status == 200)
      // request done
}Hope this help!!
PS: I would thank the guys that made me see the light: [Ajax: The Basics (Part 1)|http://courses.coreservlets.com/Course-Materials/pdf/ajax/Ajax-Basics-1.pdf]

Similar Messages

  • Content By Search web part causing issue for ajax post back implementation in Anonymous page

    We have recently migrated from SharePoint 2010 to 2013. In our site we have the registration control with ajax update panel which is working fine in all the pages other than home. After analysis, I found that this issue is happening only if the content
    by search web part exists (with loading behaviour as Sync. We tried with Async, ajax postback implementation working fine but search web part need some permission to execute the query in anonymous page).
    We got this link
    http://msdn.microsoft.com/en-us/library/ff650218.aspx which tell to include
    Microsoft.Practices.SPG.AJAXSupport.dll but we can't find this dll for VS 2012. Let us know where we can download the link.

    Hi,
    Here is a similar thread for you to take a look at:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/eb0df77b-6daf-4c63-9f0e-20bd0caae53c/referencing-microsoftpracticesspgajaxsupportdll?forum=sharepointdevelopmentprevious
    If you want to use Microsoft.Practices.SPG.AJAXSupport.dll. We can download the SharePointGuidance-August 2009.exe and install it, then we can find the project in the Source folder.
    Download:
    http://www.microsoft.com/en-us/download/confirmation.aspx?id=13284
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Problem JSF Posting back on comamndLink

    I have a commandLink in JSF that is posting back instead of going to the desired destination. Does anyone know why this might be occuring? I don't get any exceptions and the browser seems to be making a request to the server, the action just never gets executed!
    wines.jsp
    <h:column rendered="#{wineBackingBean.renderWine}">
                        <f:facet name="header">
                             <h:outputText value="Wine"/>
                        </f:facet>
                             <h:commandLink action="#{wineBackingBean.showWine}">
                                  <h:outputText value="#{wine.wineName}"/>
                             </h:commandLink>
                   </h:column>faces-config
    <navigation-rule>
              <from-view-id>
                   /wines.jsp
              </from-view-id>
              <navigation-case>
                   <from-outcome>
                        wineSelected
                   </from-outcome>
                   <to-view-id>
                        /showWine.jsp
                   </to-view-id>
              </navigation-case>
              <navigation-case>
                   <from-outcome>
                        wineEdit
                   </from-outcome>
                   <to-view-id>
                        /editWine.jsp
                   </to-view-id>
              </navigation-case>
         </navigation-rule>
    handler
         public String showWine(){
              Wine selectedWine = (Wine)ldm.getRowData();
              setWine(selectedWine);
              noteHandler.setNotes(new ListDataModel(new               AccessNotes().getNotesByWineID(selectedWine.getWineID())));
              System.out.println("wineSelected");
              return "wineSelected";
         

    Are you sure that it is posting back? Sounds like a silly question, but if you e.g. just have a testing environment where you observe this, you might play with identical page designs. The URL you see in the browser will not be refreshed upon actions (server side redirect).
    You should also check the rendered HTML to see, whether it meets your requirements.
    Volker

  • JSF and ADFBC: How to Run a method every time the page is posted back

    Hi everyone,
    I am using ADFBC and JSF in my project, and there is a page which runs the following logic: The page displays a set of radio options and a submit button. It has a total of 4 options, but they never display all at once. For example, when user enters the page for the first time, only selectItem 1 displays. When it clicks on the submit button, the page is posted back and hides the first select item, showing now the second, and so forth. The steps i did to achieve this are:
    1 - Created a method on the App Module that inserts a row corresponding to the select item choice.
    2 - Created another method that verifies which is the lastly entered row and returns a string containing the relevant attribute, for example, "E".
    3 - Created the methodAction binding to run the insertMethod (1) and retrieveMethod (2).
    4 - Created an invokeMethod executable for the retrieveMethod (2) and set the refresh property to "always".
    5 - Created a variableIterator with a variable to hold the retrieveMethod return, also setting the refresh to "always".
    6 - Lastly, bound the "rendered" attribute of each select item to the variable's value, for example "#{bindings.returnVariable == 'E'}
    When i run the page, the logic works almost fine, except for one detail: When the user clicks the button that calls insertMethod, the page is posted back, and i assume the selectItems should be re-rendered accordingly. Yet, the button click inserts the row in the DB (called insertMethod) but keeps showing the previous radio item. If i restart OC4J, when i enter the page again the radio is now correct, showing the next option.
    Do you know how can i tell the page that the model has been refreshed, so it runs the retrieveMethod again, alters the variable and the radio options without having to leave the page or restarting OC4J?
    Thanks in advance for your help!
    Regards
    Thiago Souza

    Hi all,
    It seems i have figured out the error. It was a logic mistake on my method, ADF was doing the refreshes just fine. There is another little question i wanted to ask now: I need to execute a JSF Navigation Case when the page loads, in order to navigate to another page due to a certain condition. is there any way to run some logic to redirect the request before the page has been rendered, just like the onLoad() javascript event runs on the body every time it gets loaded?
    What i'm trying to do exactly is this: When the login.jspx page runs the "success" navigation case, it goes to "page1.jspx". But before "page1.jspx" is loaded, i need to run an Application Module method to check for a certain situation; if this criteria is not met, i must run "fail" navigation case, from "page1.jspx" to "page2.jspx" without ever displaying page1.jspx.
    Is it clear enough? Can you guys give me some pointers on how to do it?
    Thanks a lot!
    Thiago

  • Cant multiple JSF Forms post to same Backing Bean?

    Wondering why cant i have two jsf forms (for example : Create & Update jsf form) post to same backing bean using value binding technique

    I have one more question
    Cant i have single JSF form post to multiple backing beans even this doesnt work for me
    Please not backing bean is in session scope in both the cases

  • How to post back to another view or skip restore view phase?

    Hi, I have a small application with a template used by every page. In this template there is a button to logout as shown below
    <h:form id="logoutForm" prependId="false">
       <h:commandButton id="logoutButton" action="#{loginBean.logout}" value="logout"/>
    </h:form>It works, but has the undesirable side effect of first triggering processing included in the constructor of other backing beans used in the page. This is because JSF first restore view of the page, and in doing that it instantiates every bean used in the view. Then after restoring the view it calls the method logout in the loginBean.
    I wanted a way to change the action of that logoutForm, but it seems it is impossible in JSF.
    Is there anything I can do to post back to another view, skipping unecessary processing that occurs in the restore view phase of the view that includes the template with the logout form?
    Thanks

    JSF is a stateful API - the stateful part is the building of the component tree server side. To be able to do this, the backing beans need to be invoked.
    So no, it is not possible to do this and keep JSF in the loop; if you really must bypass the creation of the beans, make sure the JSF servlet isn't invoked (for example, use a plain old servlet).

  • I paid $20 to upgrade my iPod touch and it didn't go through for me. The person who assisted me said that if it didn't work out that I would get my $20 posted back into my credit card. Prior to this service I made a purchase from the iTunes Store.

    I paid $20 to a person from the apple customer support line to have my iPod touch upgraded but it never went down. The representative who assisted me said that I would have those $20 posted back into my Visa card if it didn't go through. The service never got to happen and failed. Prior to this I made a purchase from the iTunes Store for $7.00, which they never billed me. So until I pay for the previous iTunes purchase, I am not allowed to download any applications. This is the reason why I need the $20 back from the separate request I made with apple which never worked out. Cause as soon as I pay for the previous iTunes purchase that I made apart from apple, then I could once again start to download and install applications. I have a week already without downloading apps. Please refund my money back a.s.a.p.

    Not sure what this is all about...
    JamesAbreu55 wrote:
    I paid $20 to a person from the apple customer support line to have my iPod touch upgraded but it never went down. ...
    However... This is a user to User Forum.
    To Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • How to get the current JSF phase in backing bean?

    How to get the current JSF phase in backing bean?
    Edited by: jimmy6 on Nov 27, 2007 7:27 AM

    I am using phasetracker to trace it also.I want to know whether it is it render response phase. I know FacesContext.getCurrentInstance().getRenderResponse() work for normal jsf component but it will not work for qiupukit datatable. FacesContext.getCurrentInstance().getRenderResponse() will not return true in the following phase. Why?
    [ INFO] 27-11-07 16:20:21 : BEFORE RENDER_RESPONSE(6) (http-80-Processor23)
    I want the 'get' method of datatable being called in response phase to reduce the number of calling because i put the query in 'get' method there. Actually i still straggling with the best practice to code the datatable...

  • Post Back Issue

    Hi,
    Sorry to bother you again. I was wondering if this time somebody could help me figure out what am I missing because the post back fro 2 buttons I have in an ASPX page go out of the portal. I have Web Controls 2.0 installed, I have the HTTP modules in my config page, I have the prender=true in my form. Oh, If I use a link button then everything works correctly. But I do not want to use a link button. I need to use a regular buttons.
    Any suggestions will be appreciated.
    Tania

    That is a know issue with the 2.0.1 web controls. Give the 2.1 beta a try and move ptrender="true" to the <asp:button> instead. The beta 2.1 work very well. Also, search this site for some of the "gotchyas". There is a fair amount of information on the developer center dealing with the web controls.
    Michael Bruce [email protected]

  • How to post back for activity confirmation

    Dear QM guru here,
    I have QM order link to inspection lot, order type is QL01.
    during i record result, i also confirm activity of labor processing.
    my problem is the screen of confirmation activity have only 3 field can input. 1. activity quantity 2. work center 3. plant.
    so every time i confirm activity system always record as system date.
    but i would like to post back to the previous. so can we config to change this screen to show date that allow to change during confirmation.
    Thank you in advance.
    Konnapa

    hi,
    Yes u may change the screen content but for that u need the screen no. and u may also take the help of an ABAPr, for screen modifications. and if u want back date posting than use user exit QLCO0002 for this.
    or if u simply want the proposed dates or confirmation dates (Previous) than u need to check ur config. -
    > Parameters for order Confirmation.
    Regards
    Edited by: D GURU on Jan 4, 2012 1:04 PM

  • How to get the button name which triggred the post back

    i have multiple buttons on the apex page most of those have the event type as "post back". is there any way to get the button name through pl/sql which raised the post back event ?

    Tried v('REQUEST') or :REQUEST?

  • Post Back Tree view when tree node check changed

    Hi everyone, 
    I have a tree view, both child and parent have check box. I want to check all the child on the parent selection. 
    I try "SelectedNodeChanged" but the page doesn't post back to fire my function.
    I know I can use javascript to post back the page, but is there any other way to post back my page without javascript???  
    Thnaks in advance. 

    Hi everyone, 
    I have a tree view, both child and parent have check box. I want to check all the child on the parent selection. 
    I try "SelectedNodeChanged" but the page doesn't post back to fire my function.
    I know I can use javascript to post back the page, but is there any other way to post back my page without javascript???  
    Thnaks in advance. 
    Assuming this is a WinForm application (it looks like it may not be), the following works pretty well:
    Option Strict On
    Option Explicit On
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    With TreeView1
    .CheckBoxes = True
    .ShowLines = True
    .ShowPlusMinus = True
    .ShowRootLines = True
    .ExpandAll()
    End With
    End Sub
    ' Updates all child tree nodes recursively.
    Private Sub CheckAllChildNodes(ByVal treeNode As TreeNode, ByVal nodeChecked As Boolean)
    Dim node As TreeNode
    For Each node In treeNode.Nodes
    node.Checked = nodeChecked
    If node.Nodes.Count > 0 Then
    ' If the current node has child nodes, call the CheckAllChildsNodes method recursively.
    Me.CheckAllChildNodes(node, nodeChecked)
    End If
    Next node
    End Sub
    ' NOTE This code can be added to the BeforeCheck event handler instead of the AfterCheck event.
    ' After a tree node's Checked property is changed, all its child nodes are updated to the same value.
    Private Sub node_AfterCheck(ByVal sender As Object, ByVal e As TreeViewEventArgs) Handles TreeView1.AfterCheck
    ' The code only executes if the user caused the checked state to change.
    If e.Action <> TreeViewAction.Unknown Then
    If e.Node.Nodes.Count > 0 Then
    ' Calls the CheckAllChildNodes method, passing in the current
    ' Checked value of the TreeNode whose checked state changed.
    Me.CheckAllChildNodes(e.Node, e.Node.Checked)
    End If
    End If
    End Sub
    End Class
    The reference for that is this MSDN document.
    If you're looking for a true tri-state operation though, honestly you might want to look at some third-party controls.
    I hope that helps. :)
    Please call me Frank :)

  • Bug : new page request is treated as post back

    Requesting a page by clicking hyperlink in other page is treated as post back, if STATE_SAVING_METHOD is set to server.

    This is a user to user support forum. you are not addressing Apple. You can offer Apple feedback here: http://www.apple.com/feedback/

  • Ajax Post to .cfm throws IIS 500 (but same post to .aspx does not error)

    I have a cross domain ajax call properly set up and tested to resolve to a .cfm but IIS throws a 500 error.
    Here is the scenario:
    On one domain (a.tld) I have an ajax application.
    This application posts to another domain (b.tld).
    When a.tld posts to a .cfm on b.tld, I get a 500 error. But, when a.tld posts to a .aspx on b.tld, it returns just fine. Both the .cfm and the .aspx are returning a single json name value pair (really just some text).
    Now, this is interesting, when I switch the POST to a GET, the .cfm works just fine. So, to summarize:
    1. ajax POST to aspx works fine.
    2. ajax POST to cf gives 500 error.
    3. ajax GET to cf is fine.
    So, this appears that IIS is blocking ColdFusion from getting the cross domain ajax call or that ColdFusion does not have permission to act on the POST. Does anyone know what might be causing this issue?

    Have the same problem.  Ajax and Post do not play well together.  Last I checked it is a browser problem.
    Using “GET” is a problem too if you need to ajax a lot of data. . 
    If you are using the ajax to validate a page, a good work around is to open a dhtml iframe window (see http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm) and then do the validation in popup window. 
    As you are validating, use cfflush to show what’s going on:
    Checking value 1:  Pass
    Checking value 2:  Pass
    Checking value 3: Fail  - date range is not valid.

  • Jsf Ajax integration

    hello All
    Has anyone come across the issue with JSF ajax integration in JSF 2. When I try to use jsf 2 F:ajax TAG i GET THE following error
    JSF1064: Unable to find or serve resource, jsf.js.xhtml
    Thanks for your help
    Nek

    Unfortunately you are not giving us enough information. How are you using the tag?

Maybe you are looking for

  • Whenever I open a pdf document with Adobe Readeron my PC, nightly automatically opens a blank tab.

    Whenever I open a local pdf document with Adobe Reader, nightly automatically opens a blank tab.

  • Help please:set up mac 10.4.11 with ext dsl modem to send and receive faxes

    Hi and thanks in advance. I have a G4MDD dual processor, and have a dsl modem for internet connection. I want to set up to send and receive faxes. I can make and receive phone calls while connected to the internet. any ideas or help appreciated. Than

  • Calling RFC from custom connector

    Hi, I am developing a custom connector for UWL to get tasks from 3rd party system. I need to call a RFC from backend SAP system to complete Input data for this 3rd party provider. I assume that I have to make an RFC call from getItems() method of con

  • Deprecated Xpath 1.0 functions in 11gR2

    According to this whitepaper: http://www.oracle.com/technetwork/database/features/xmldb/xmlqueryoptimize11gr2-168036.pdf Starting 11gR2, Oracle has deprecated many older proprietary mainly XPath 1.0 based operators in favor of standards based XQuery

  • Update wont complete

    I have tried Downloading the latest iTunes version many times. When I do, it runs for a few minutes and then this pops up "Errors occurred while installing the updates. If the problem persists, choose Tools>Download Only and try installing manually.