July 31, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Implementing AJAX Components in the JWL Framework

  • April 17, 2008
  • By Aleksey Shevchenko
  • Send Email »
  • More Articles »
  1. Open ajaxExternalRequestExample.jsp in Source mode.
  2. In Pane "Palette", click "Enhanced Faces Components" (make sure you are in a Web perspective).
  3. Figure 18: View of the "Palette" Pane

  4. Drag and drop the Panel Group component from the palette to the page.
  5. Drag and drop the Text Output component from the palette to the panel that you added in Step 5. Set the value of the component to "External Page will be loaded here."
  6. Select the Panel Group and click Properties → AJAX. Click on "Allow Ajax Updates" and set Ajax request to "External".


  7. Click here for a larger image.

    Figure 19: View of AJAX Properties

  8. Click the <hx:ajaxExternalRequest> tag that was added in Step 7 and click Properties. Type "externalPage.faces" in the URL field.


  9. Click here for a larger image.

    Figure 20: AjaxExternalRequest Properties

  10. Run this page on the server (make sure you are running under Websphere 6.1 or higher).
  11. Test your code.
  12. Figure 21: AjaxExternalRequest Example Output

Listing 8 is the full source code of what you have just gone through. You can find full source code as an attachment at the end of this article.

Listing 8: AjaxExternalRequest Full Source Code

<f:view>
   <body>
   <hx:scriptCollector id="scriptCollector1">
      <h:form id="form1" styleClass="form">

      <hx:commandExButton type="submit"
                          value="Submit"
                          id="button1"
                          styleClass="commandExButton">
         <hx:behavior event="onclick"
                      behaviorAction="get;stop"
                      targetAction="group1">
         </hx:behavior>
      </hx:commandExButton>
      <h:panelGroup id="group1" styleClass="panelGroup">
         <h:outputText id="text2"
                       styleClass="outputText"
                       value="External Page will be loaded here!">
         </h:outputText>
      </h:panelGroup>
         <hx:ajaxExternalRequest id="ajaxExternalRequest1"
                                 target="group1"
                                 href="externalPage.faces"
                                 source="group1">
         </hx:ajaxExternalRequest>
      </h:form>
   </hx:scriptCollector>
   </body>
</f:view>

Download Source Code Here

JWL.war

Reference

IBM: http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/ com.ibm.etools.jsf.doc/topics/rjsfcompAjax.html

About the Author

Aleksey Shevchenko has been working with object-oriented languages for eight years. For the past four years, he has served as a technical lead and a project manager. Aleksey has been implementing Enterprise IT solutions for Wall Street and the manufacturing and publishing industries.





Page 6 of 6



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel