JSF AJAX through PhaseListener

Can someone point to a reference article or blog which shows the PhaseListener approach of enhancing a JSF component for AJAX.
A simple example on the way it is implemented will suffice

https://blueprints.dev.java.net/bpcatalog/ee5/ajax/phaselistener.html

Similar Messages

  • I use js change the sequence of options, JSF go through lifecycle, why?

    Hi,All
    When I use javascript change the sequence of options,
    JSF go through Restore View, Apply Request Value,
    Process Validations, Render Response four lifecycle. why?
    <f:view>
    <head>
    <script>
    function moveDown()
         var selObj = document.getElementById("org_rank:childOrgs");
         var index = selObj.selectedIndex;
         if (index == -1 || index >= selObj.options.length - 1)
         return;
         var selectedText = selObj.options[index].text;
         var selectedValue = selObj.options[index].value;
         selObj.options[index].text = selObj.options[index + 1].text;
         selObj.options[index].value = selObj.options[index + 1].value;
         selObj.options[index + 1].text = selectedText;
         selObj.options[index + 1].value = selectedValue;
         //selObj.options[index + 1].selected = true;
    </script>
    </head>
    <body>
    <h:form id="org_rank">
    <table align="center" border="1" cellpadding="0" cellspacing="0">
    <tr>
    <td align="middle" heigth="100" width="160">
    <h:selectOneListbox id="childOrgs" value="#{orgDelegate.curId}" style="height:100px;width:150px" >
    <f:selectItems id="orgNames" value="#{orgDelegate.orgNames}" />
    </h:selectOneListbox>
    </td>
    <td align="middle" width="80">
    <h:commandButton value="down" onclick="moveDown()" /><br><br>
    </td>
    </tr>
    </table>
    <h:messages styleClass="errorMessage" layout="table" showDetail="true" showSummary="false" />
    </h:form>
    </body>
    </f:view>

    When you say the text shrinks when you change the size of the window, do you mean in terms of making the window smaller / zooming out from the page so that for instance you can see more of the "page" that you're working on?
    If so then that's by design and is how it's always been. The view you see in Word is designed to represent what would appear on the page if you printed it, so relative to the page the text remains the same size. If you change the page so that you can see
    more of it, eg effectively zooming out, then the size of the text must shrink. It's no different to holding a physical document in front of you, if you move the paper further away from you so the page looks smaller, the text will as well.
    On the other hand if you mean when you make the window smaller, eg displaying less of the grey space on either side, that the page and text shrink then I don't know what you mean. Which version of Word are you using? I've tried with Word documents in Word
    2010 and Word 2013, and in both cases simply changing the size of the document window does nothing to the view of the document (other than make it impossible to read all the test on a line without scrolling if I go too far.

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

  • JSF/Ajax adoption in the industry

    All,
    We have been using JSF/Ajax since last couple of years. What I wanted to find out from the user community in this group is ,
    - how is JSF, Ajax combination being adopted in the industry?
    - What do experts see as the growth for JSF?
    - Are organizations spending time/money in training their in-house resources?
    Regards,
    Praveen

    EJP wrote:
    I will answer the last of those questions. The last time I saw any organization training its in-house resources in anything to do with IT was fifteen years ago.I've had some training, but indeed nothing IT related, usually in the soft skills. And why not; most IT related things you may want to learn require nothing more than a good book, patience and applying some thought.
    I'm waiting for the offer to learn how to say NO! without hurting feelings ;)

  • JSF-Ajax  framework.

    Hi all,
    Can anybody suggest any jsf-ajax framework which is free...?
    Waiting for u'r reply..
    Regards,
    Jijo

    ajax4jsf.dev.java.net

  • JSF/AJAX

    Greetings to all, i have been reading about enabling JSF components with AJAX, and in the free or open world i have found the following alternatives:
    -Ajaxanywhere
    -Ajax4Jsf
    -AjaxFaces
    -IceFaces
    -Dynamic Faces
    Questions:
    1. What framework do you recommend ?
    2.Do anyone has experience about ?
    Remember, in order to apply in a free or open project, it means that we can not use ADF FACES.
    Thanks in advance, technologists !!!

    Hi,
    sorry that I have to leave the choice to you. Note that ADF Faces is open sourced through MyFaces Trinidad on the Apache.org website.
    Frank

  • It looks Oracle Form/Applet  die hard versus J2EE Servlet/JSP/JSF  & AJAX

    I left the form forum for a while and am busy with transfering our Oracle web forms app to Struts based J2EE application (just because the Oracle EE AS is the moving cause, it's out of my control.). After a year or so on J2EE which I enjoyed the fresh OO coding while keep enhancing Oracle webform app in production, I have some thought on Applet vs J2EE JSP/JSF plus AJAX.
    1) JSP itself is hard to avoid the full screen refreshing even though user just does partial changes ,e.g., lists, on the screen, it has to use AJAX to do the tricks. While partial refreshing in applet is natural default behavior.
    2) Forms is really an RAD, while J2EE's IDEs does help a bit(IBM's Websphere v6 even called iRAD) which takes way longer programming time compared to Forms. One IBM's article says it trys to win the Oracle Forms developers by giving the familiar graphical way of drag/drop GUI, so IBM recognizes the RAD coding power of Oracle Forms. So, IBM promotes the RAD similar to Oracle Forms.
    3) GUI/business rules related validation: Applet offered a great advantage over JSP/ even JSF which to avoid the full screen refresh, AJAX/JavaScript is used heavily. User friendly interaction of applet is way better than J2EE.
    4) Browser's back/refresh buttons also are headache to J2EE, expecially we need to support IE and Firefox. Applet basically is not bothered by these buttons.
    Recently, I read techi news said that the new chips will make the network transfer speed 10 time faster than now-even the cell phone transfer the image will be way faster. Then I predict the applet, just like IBM's mainframe, will see its Spring again, not like now in its winter. Especially the Oracle Forms makes coding easier than pure applet coding.
    Oracle folks, kepp beefing up the Oracle Forms, don't just pay attention to JDev. J2EE IDE, most of all, remove the Oracle EE ASxx block, be open. Oracle EE ASxx is really not a pretty baby, even though so Oracle thinks it is.

    1) Why we are transfering your Oracle web forms app to Struts based J2EE application?
    Since our corporate is IBM world-DB2/UDB, WebSphere AS (WAS) etc. It only allows Oracle Forms/reports servers to be compatible with the infrastructure. It does not allow to purchase another EE app server(espeically LDAP). We could not upgrade our forms/reports6i to 9i or 10g.
    2.Therefore the Oracle EE AS is the moving cause, it's out of my control because I did my best to talk to Oracle sales, but no avail. I am glad that I got a good chance to beef up my J2EE Struts skills.
    If extract out the forms/report9i/10g engines from the Oracle EE AS 9i/10g, (don't attempt to bundle sell the EE AS to customers-regardless of the shrinked 9.0.4 forms/reports services version, it's still another EE AS) and make them compatible with other ASs(espcially the LDAP), then Oracle Forms will have more customers.

  • JSF AJAXed custom component

    Hi,
    I've read the article on bpcatalog for enable jsf components with ajax. Everything is fine, but I can'y understand one thing:
    In Strategy 2, how do we map the servlet that handles the ajax request (AjaxControllerServlet) to certan url. In strategy 1 this is done by decalrring phase listener in faces-config.xml and in strategy 3 this is done by maping url to servlet in web.xml.
    Thanks in advance.

    what IDE are you using?

  • Gernerate JSF page through program

    Hi all of you,
    my name is Salomon i am a beginer in JSF programming with Oracle Jdeveloper 10g release 3.
    My difficulty is how to acivate and desactivate UI components on JSF page (or rather JSP page) through program (maybe a method integrated in class associated with JSP page)
    ,and also add or remove UI components on the JSP programmaticaly.
    I am looking forward in hearing from you soon.
    Thank you

    Hi,
    thank for your response but i got another problem:
    How to reach a component which is in jsf page whithin another jsf page
    programmaticaly so that i can modify its properties (mainly hide or show a commandbutton menu item ...) before displaying this page (page containing the component to modify) through the " return outcomename " statement.
    Thank you
    Salomon
    Message was edited by:
    user554608

  • Find all beans referenced on a JSF page for PhaseListener

    I am trying to implement a PhaseListener to do some application specific stuff just before the render response phase. I am trying to find all of the managed beans referenced in the currently executing JSF page. So for example, if I had this in a page:
    <h:selectOneListBox id="foo" value="#{foo.bar}">
      <f:selectItems value="#{bazz.list}"/>
    </h:selectOneListBox>I would want to be able to locate both the beans "foo" and "bazz" (both are managed beans) inside the PhaseListener without using their names (unless I can first discover all the names referenced on the page).
    Basically, I am looking for a generic way to process all managed beans that are used on a page just before the response is rendered.. Anyone have any ideas on this?

    Do something likepublic class MyPhaseListener implements PhaseListener {
        public void beforePhase(PhaseEvent event) {
            // Do nothing.
        public void afterPhase(PhaseEvent event) {
            List children = (List) ((ArrayList) event.getFacesContext().getViewRoot().getChildren()).clone();
            List bindings = new ArrayList();
            for (Iterator iter = children.iterator(); iter.hasNext();) {
                UIComponent component = (UIComponent) iter.next();
                children.addAll(component.getChildren());
                ValueBinding binding = component.getValueBinding("value"); // Get the "value" attribute.
                if (binding != null) {
                    bindings.add(binding.getExpressionString()); // Get the EL string, eg. #{myBean.value}.
            // Do your thing with the bindings.
        public PhaseId getPhaseId() {
            return PhaseId.RENDER_RESPONSE;
    }

  • JSF/AJAX vs JSON-RPC/AJAX

    Has anyone directly compared these two approaches to rich internet client applications? I am in the process of choosing a technology base for AJAX applications, and see some attraction in the lighter weight of JSON, and the direct access to java objects from javascript looks appealing and much simpler than JSF. It does appear that the JSON-RPC-Java approach will require the client js to handle all of the UI events. How much effort in this area does JSF save?

    I should have been more clear.
    On the https://bpcatalog.dev.java.net page in the left navbar is a link to the CVS repository "Version control - CVS", click on it. Then there is a link "Setup CVS command line client" that leads you to a the page ( https://bpcatalog.dev.java.net/servlets/ProjectSource) that you will have to login to see. This page tells you how to connect and download with CVS.
    I have summarized the page content below:
    Hope this helps - Thanks - Mark
    To use WinCvs to check out your own set of source code files, you must first set up the correct cvs root using the following steps.
    1. Launch WinCvs and select Admin - Preferences. Enter the CVSroot:
    :pserver:[email protected]:/cvs
    Click OK.
    2. If this is your first cvs checkout, create a folder in Windows Explorer to hold all of your cvs project folders. Then create a subfolder for this project. (You may even want to create separate subfolders for each module if you're working in more than one.)
    3. In WinCvs, select Admin - Login and enter your CVS password.
    4. Click on the left window in the program and select a folder. Then select Create - Checkout Module. Select the project folder you created earlier.
    5. Enter the project module name and click OK. You should see a scrolling list of filenames as these are created in your folder(s).
    6. Repeat the module creation process for each additional cvs module you wish to check out.

  • JSF Ajax script error in IE8 while session times out

    We have JSF 1.1, Richfaces a4j 3.1.6 in our application.
    We get an empty page with the script error when the session timesout. When we make any ajax request after the session expires, the script error pops up. We noticed this only in IE8.
    I get this error on IE8 for session timeout.
    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; MS-RTC LM 8)
    Timestamp: Fri, 28 May 2010 15:26:37 UTC
    Message: Object doesn't support this property or method
    Line: 83
    Char: 390
    Code: 0
    URI: http://localhost:8080/sir/loan/a4j_3_1_6.GAorg.ajax4jsf.javascript.AjaxScript.jsf
    Appreciate your help.

    Upgrade your ancient technology. JSF 1.2.12 at the least with Richfaces 3.3.3.
    OR
    accept that your ancient technology will have flaws and live with them.

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

  • JSF AJAX problem

    Hi every body I am using ajax for jsf for form submit .I can use this.form.submit() , but I want to use the ajax type form submission .It is working fine in the fire fox , but when I am running my application on IE it is not working .
    Is there any limitation in ajax for JSF in IE ?
    thanks ,
    SB

    Hi every body I am using ajax for jsf for form submit .I can use this.form.submit() , but I want to use the ajax type form submission .It is working fine in the fire fox , but when I am running my application on IE it is not working .
    Is there any limitation in ajax for JSF in IE ?
    thanks ,
    SB

  • JSF/AJAX Best Choice for free

    Greetings to all, i have been reading about enabling JSF components with AJAX, and in the free or open world i have found the following alternatives:
    -Ajaxanywhere
    -Ajax4Jsf
    -AjaxFaces
    -IceFaces
    -Dynamic Faces (From Sun Microsystem)
    -MyFaces
    Questions:
    1.What framework do you recommend ?
    2.Do anyone has experience about ?
    Remember, in order to apply in a free or open project, it means that we can not use ADF FACES.
    Thanks in advance, technologists !!!

    Thanks Kris by your answer, i was checking about Myfaces, and found the following:
    - The ADF Faces donated by Oracle to Apache is in the incubator phase, that is, in testing and it has not been released still, but you can use it by your own risk.
    - In MyFaces project, you can use the MyFaces wich is the Apache References Implementation of JSF, and you can use the MyFaces's subproject "Tomahawk" which is an aditional components made by MyFaces to enhance to traditional JSF components.
    Then, let's go to try with that free technology !!!

Maybe you are looking for