Home > SAP All-in-One Guides > SAP XI/PI > Adapter framework > Ajax everywhere: Which framework to choose?
All-in-One Guides: SAP XI/PI:
EMAIL THIS
 START   NETWEAVER   SAP XI   COMPARISON ANALYSIS   SAP XI FOR DEVELOPERS   ADAPTER FRAMEWORK   SAP BPM   SOA   SAP XI GAMES   
Adapter framework

<< PREVIOUS | NEXT >>: Integrating JD Edwards with XI using IWAY adapters...
 TIPS & NEWSLETTERS TOPICS 

SAP ABAP/JAVA DEVELOPER TIPS

Ajax everywhere: Which framework to choose?


W. Jason Gilmore
10.17.2006
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Ajax melds the responsiveness of the desktop environment with the ubiquity and extensibility of the Web. Because of this clever JavaScript- and XML-driven development technique, we see impressive next-generation Web applications such as Google's Gmail, improved e-commerce interfaces such as that found on Gucci.com and rich interactive experiences on community sites such as Digg.com.

Yet despite Ajax' promise, many developers remain reluctant to embrace the new paradigm. With Ajax, developers must be able to write JavaScript more efficiently than ever before, but many resist this because the language is notoriously difficult to write and debug.

Numerous Ajax-specific frameworks, libraries and toolkits can reduce or eliminate the need to interact directly with JavaScript, but that begs the question: which solution should you choose? AjaxPatterns.org lists over 150 projects across numerous categories, but the right tool depends upon your particular needs.

In this article, we introduce some of the key solutions and offer several examples to show the dramatic effect they can have on JavaScript integration.

Prototype

Prototype is a framework capable of facilitating all manners of JavaScript development by extending the language with new syntax and features that render your development efforts much more efficient. Offering a Ruby-style syntax and a number of mechanisms for accessing and manipulating data structures (for instance, an Enumerable object is available), prototype is extraordinarily powerful and sets the standard for all other solutions.

The following example highlights prototype's excellent forms-handling capabilities, showing you how a text-field value can be made available to a JavaScript function using prototype syntax. From there, the email address can be transparently passed to the server for processing, validation, or any other purpose:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>  
  <title>prototype - Form</title>
   <script type="text/javascript" src="scriptaculous/prototype.js"></script>

   <script type="text/javascript">
        function processform() {
            var email = $F("text_email");      // retrieve email value
            alert("Your email address is " + email);
        }
    </script>

</head>

<body>

<form action="" method="post">

Email Address:<br />
<input type="text" id="text_email" name="email" /><br />
<input type="submit" id="butt_submit" value="Submit" onClick="processform();">

</form>

</body>

</html>

To retrieve the form value, all you need to do is pass the desired id into the $F() function, as shown above.

Click here for a demonstration of this script.

Script.aculo.us

Of these specialized solutions, Scriptaculous, a library based on the aforementioned Prototype framework, is the most popular. Intended to render Ajax integration even easier, Scriptaculous offers a predefined selection of controls (such as sortable lists, draggable and droppable objects and autocompleting text fields); visual effects that can affect the opacity, position, size and other characteristics of DOM objects; and even tools for performing JavaScript unit testing.

Numerous high-profile Web sites depend on Scriptaculous, including Digg.com and Apple, as well as frameworks such as symfony and Ruby on Rails.

Scriptaculous' popularity can partially be attributed to its array of capabilities but perhaps even more so to its simplicity. For instance, suppose you wanted to create a mechanism for hiding part of a Web page at the user's discretion. One commonly used method is known as the "blind", due to its behavior which closely mimics that of a window blind.

The code involved in implementing this feature is amazingly simple, and is shown here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>  
  <title>Scriptaculous - Fade Out</title>
   <script src="scriptaculous/prototype.js" type="text/javascript"></script>
   <script src="scriptaculous/scriptaculous.js" type="text/javascript"></script>
   <link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body>

<div id="login">
   <div id="menu-login">
      username: <input type="text" name="username" size="15" maxlength="25" value=""> 
      password: <input type="text" name="pswd" size="15" maxlength="25" value=""> 
      <input type="submit" id="butt-login" value="login">
   </div>
<br />
<a href="#" onclick="Effect.toggle('menu-login', 'blind'); return false">Toggle Login Menu</a>
</login>

</body>

</html>

Click here for a demonstration of this script.

As you can see from this example, implementing the blind effect is as simple as triggering the Effect.toggle() function, passing in the DOM object id and the desired effect.

dojo

Another popular JavaScript-driven general solution is the dojo toolkit, which implements a wide variety of Ajax and JavaScript features.

Perhaps best known for the impressive number of widgets it provides, the dojo toolkit can create complex layouts and form controls closely resembling those found in the most advanced desktop applications. Functions are also available for tasks as disparate as cryptography, data validation, data structure manipulation and logging.

The following example demonstrates one of dojo's built-in widgets, the calendar. After reviewing the code, follow the link to the demonstration and play around with the widget by changing the month and year settings.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>  
  <title>dojo - Calendar</title>
   <script type="text/javascript" src="dojo/dojo.js"></script>
   <script type="text/javascript">
       dojo.require("dojo.widget.html.DatePicker");
    </script>
</head>

<body>

<div dojoType="DatePicker"></div>


</body>

</html>

Click here for a demonstration of this script.

Atlas (ASP.NET Ajax)

For some time now, Microsoft has been touting the Atlas framework (which, true to Microsoft's fixation with renaming technologies, has recently been renamed ASP.NET AJAX). Atlas is Microsoft's freely available solution for building the next generation of Web applications using Ajax.

Although primarily intended to help ASP.NET developers easily integrate Ajax capabilities into their Web applications, this framework is split into two separate components: an ASP.NET extension that offers Ajax-oriented server controls (known as ASP.NET AJAX Extensions) and a 100% JavaScript-driven client-side library (known as the Microsoft AJAX Library). As a result, developers hailing from any language can take advantage of the client-side library.

Specialized solutions

A variety of specialized frameworks exist for carrying out specialized tasks, such as logging, Web services and Flash integration. For instance, log4javascript is a JavaScript-specific logging framework that can render your JavaScript debugging process far more efficient than the alert box.

Still other solutions are even more specialized. These solutions are powerful because they provide an immediate and highly configurable implementation of a desired feature. Take a moment to view a particularly impressive solution for image slide shows called jondesign's smooth slideshow.

Even if you're looking to deploy a very specific feature that would conceivably be also deployed on other sites, be sure to take a look around the Web for freely available solutions before building your own.

Server-side solutions

Numerous solutions can tightly integrate Ajax with developers' preferred server-side Web development language. For instance, AjaxPatterns lists 28 PHP-driven solutions, 34 Java-driven solutions and even one Lisp-specific solution.

Before seeking out one of these solutions, keep in mind that many frameworks (Ruby on Rails, symfony, and Catalyst, for instance) already offer Ajax and JavaScript solutions. Two particularly compelling PHP-specific solutions include the HTML_AJAX PEAR package, and xajax.

Conclusion

Solutions abound for minimizing the grief involved in incorporating JavaScript into your Web applications. Be sure to take some time to carefully weigh your options, and let me know what you've chosen by emailing me at wjATwjgilmore.com!

This tip originally appeared on SearchOpenSource.com.

Rate this Tip
To rate tips, you must be a member of SearchSAP.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


<< PREVIOUS | NEXT >>: Integrating JD Edwards with XI using IWAY adapters...
VIEW ALL IN THIS CATEGORY


RELATED CONTENT
SAP ABAP/Java developer tips
How to do additional dialog processing after SAP COMMIT WORK statement
How to find a piece of SAP ABAP code without debugging
How to read an SAP transaction in an ABAP code
How to provide an SAP R/3 4.5B application server with a Web service interface
How to find owners and transports of deleted ABAP programs
Fixing a common OPEN_FORM and START_FORM error in SAPscript
Select Text fields: Case-insensitive
Is this the quickest way to find a BADI?
Easily debug error messages in SAP processes
Accessing private attributes in ABAP Objects

SAP PI/XI
NetWeaver PI 7.1 easier to implement than earlier versions, SAP says
Getting started with SAP NetWeaver PI (formerly XI)
Bucking the economic trend, HSBC embarks on NetWeaver PI project
How to be a self-taught NetWeaver and ABAP expert
An ABAP user wants to learn XI
What are the benefits of EAI?
Quiz: SAP XI for beginners
XI: Search through the payload of a message... without TREX!
Automate the process of uploading catalogs using XI
Using Folders in PI 7.1
SAP PI/XI Research

Adapter framework
List of all adapters compatible with XI 3.0
Cost for licensing and implementation of the Seeburger EDI adapter for SAP XI
Can we integrate XI with the MQ series for connecting mainframes without using adapters?
Integrating JD Edwards with XI using IWAY adapters part 3
Integrating JD Edwards with XI using IWAY adapters part 2
Integrating JD Edwards with XI using IWAY adapters part 1

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
SAP Exchange Infrastructure  (SearchSAP.com)
SAP Integration Adapter  (SearchSAP.com)
SAP Integration Repository  (SearchSAP.com)
SAP Integration Server  (SearchSAP.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



NetWeaver SAP White Papers
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts