Monday, February 27, 2006

AJAX Resources

As the support for AJAX grows, I thought it will be a nice idea to have a blog post with constantly updated lists of AJAX resource links. I will post the latest links to tutorials, articles, frameworks and other resources related to AJAX with reference to Java and JEE. Here are the links

  1. Ajax: A New Approach to Web Applications: This is where it all started (to be specific, the name - AJAX).
  2. AJAX for Java developers is an IBM developerworks series by Philip McCarthy. This series contains articles on how AJAX can be used to compliment J2EE Web applications.
    1. Ajax for Java developers: Building Dynamic Java Applications
    2. Ajax for Java developers: Java object serialization for Ajax
    3. Ajax for Java developers: Ajax with Direct Web Remoting
    4. Ajax for Java developers: Exploring the Google Web Toolkit
  3. Mastering AJAX is an ongoing series on IBM Developerworks by Brett McLaughlin which introduces the central concepts of Ajax, including the XMLHttpRequest object.
    1. Mastering Ajax, Part 1: Introduction to Ajax
    2. Mastering Ajax, Part 2: Make asynchronous requests with JavaScript and Ajax
    3. Mastering Ajax, Part 3: Advanced requests and responses in Ajax
    4. Mastering Ajax, Part 4: Exploiting DOM for Web response
    5. Mastering Ajax, Part 5: Manipulate the DOM
  4. AJAX with J2EE: A sub-section in the Java blueprints on AJAX with Java Server Faces (JSF).
  5. AJAX patterns: An Ajax portal and homepage for the upcoming "Ajax Design Patterns" book (O'Reilly), with full text online
  6. AJAX Lessons: Simple AJAX tutorials and news.
  7. AJAX Freaks: This website exists to provide you with information to use while learning or developing AJAX.
  8. **Ajaxian: An excellent source of up-to-date information articles and tutorials and news on AJAX as it relates to .NET, Java, Perl, PHP, Python, Ruby ... and the list goes on. This would be a good places to start your search on AJAX.
  9. AjaxTags: A JSP tag library with some easy to use widgets for creating Ajax-enabled Web Forms.
  10. Here are my old blog posts related to AJAX:
    1. AJAX and J2EE: My first post on AJAX and how it relates to J2EE.
    2. AJAX Toolkit Framework for Eclipse: About the AJAX toolkit framework project for eclipse.
    3. AjaxTags for Java Server Pages: Overview of AjaxTags.

    Tuesday, February 21, 2006


    The Glassfish community is building a free, open source application server which implements the newest features in the Java EE 5 platform (the next version of the J2EE platform) as well as tools to administer the server. While the Java EE 5 specification is not yet finalized, the Glassfish community provides milestone builds which implement current version of the specification. The latest milestone build (5) is availabe for download at the Glassfish site. This build implements the public final draft of version of all the Java EE 5 specifications except EJB 3.0. Here is a link to the JEE 5 API docs. The public review draft of the Java EE 5 specification is available on the JCP site as JSR244. Here are a few features new to Java EE 5 over J2EE 1.4:
    • Most boilerplate requirements have been eliminated, and XML descriptors are now optional. For example, the ejb-jar.xml descriptor is no longer necessary in most cases.
    • More defaults are available, with a special emphasis on making them meaningful. Developers now have fewer details to remember.
    • Web service support is simpler, and the number of supported standards has increased.
    • The EJB software programming model is significantly simpler.
    • The new Java Persistence API is available to all Java platform applications, including those based on EJB technology.
    • JavaServer Faces technology has been added to make web application design more convenient.

    Thursday, February 16, 2006


    If you try to modify a list while iterating through it, then you will encounter the ConcurrentModificationException. This is described in the code below

    List<Integer> intList = new ArrayList<Integer>();

    try {
    for(Integer i:intList) {
    if(i.intValue() % 2 == 0)
    } catch(ConcurrentModificationException cme) {
    System.out.println("Cannot modify a List while iterating");

    In order to remove values you can always use the iterator.remove method that removes the most recent item that was returned from the iterator as shown below

    Iterator<Integer> iter = intList.iterator();
    while(iter.hasNext()) {
    int j =;
    if(j%2 == 0) {
    While this method works fine for removing items, you may not add items to the list, since the Iterator interface does not support an add method. There are a couple of ways help add and remove while iterating through the list. This can be done by converting the list to an array using the toArray method and then iterating through the array and then removing or adding from the list as shown below (in the two code snippets remove can replaced by add.

    Integer[] intArray = (Integer[]) intList.toArray(new Integer[intList.size()]);
    // Read list and try to remove from the list..
    for(Integer i:intArray) {
    if(i.intValue() % 2 == 0)

    Object[] objArray = intList.toArray();
    // Read list and try to remove from the list..
    for(Object j:objArray) {
    Integer i = (Integer) j;
    if(i.intValue() % 2 == 0)

    The above code was tested on JSDK 1.5.0_06 on windows XP.

    Wednesday, February 15, 2006

    Dependency Injection

    In order to reduce the amount of coupling between components, most programmers follow the "Program to an interface, not an implementation" principle, which is the first principle defined in the GoF Design patterns book. In doing so, you will be able to change the implementation without affecting the client programmed to the published interface. One more advantage of doing so is that the implementation class can be defined at runtime. This is done through dependency injection. For example

    public class Client {
    private MyInterface var;
    public Client(MyInterface var1) {
    var = var1;
    // Instead of var = new MyImplementation();

    Now without any reference to the actual implementation, we can write the client program. The method described above is also known as Constructor Injection (which is a variant of Dependency Injection). The other variant is Setter Injection, in which a setter is provided to set the value of the dependency (MyImplementation in the above example). Martin fowler has nice introduction to depency injection on his website.

    Tuesday, February 07, 2006

    WebSphere Performance Tuning

    The following are a few quick tips to improve WebSphere Application Server performance. From the websphere performance tuning for the impatient article.

    Enabling verbose garbage collection can help determine if the memory heap size is too big or enough or too small.
    To enable verbose garbage collection through the WebSphere administrative console, click Servers > Application Servers > server_name > Process Definition > Java Virtual Machine. The following picture illustrates the changes that have to be made.

    Change the heap size so that the GC cycle.
    • Occurs at intervals longer than 10 seconds or so.

    • Takes 1 to 2 seconds or so to complete.
    To change the JVM heap size, refer to the picture above.

    The "sweet spot" for a small (4 CPU) database server is servicing 100-200 connections. To change the connection pool size from WebSphere administrative console, click Resources > JDBC Providers > JDBC_provider > Data Sources > data_source > Connection Pool. This setting is illustrated in the following picture.

    To turn servlet caching on or off from WebSphere administrative console, click Servers > Application Servers > server_instance > Web container and check or uncheck the "Enable servlet caching" checkbox. The following diagram illustrates these step.

    A CPU can drive 50 to 75 Java threads. To modify the thread count through WebSphere Administrative console, click Servers > Application Servers > server_instance > Web container > Thread Pool and modify the Minimum size and Maximum size of the thread pool. The following diagram illustrates this step.

    All the tips described above are from the latest article on WebSphere Performance Tuning for the impatient on Developerworks. This post is a simple description of how to achieve the steps described there (in Jython) using the WAS administrative console. For more information, refer to the article.

    Monday, February 06, 2006

    J2EE Frameworks

    Joel on Software has a discussion on Why I hate Frameworks. It is good read with a nice analogy to current J2EE frameworks.

    Thursday, February 02, 2006

    AJAX Toolkit Framework for Eclipse

    The proposal for incubation of the AJAX Tookit Framework within Eclipse WTP can be found here. The proposal states that the
    AJAX Toolkit Framework (ATF) will provide extensible frameworks and exemplary
    tools for building IDEs for the many different AJAX runtime offerings (Dojo,
    Zimbra, etc). These frameworks will contain features for developing, deploying,
    debugging and testing AJAX applications.
    The initial set of tools built on these proposal will include:
    • Enhanced Javascript editing features such as Batch and runtime (as-you-type) syntax validation.
    • A JavaScript debugger that will be tightly integrated with Eclipse debug UI.
    • Embedded Mozilla browser.
    • Embedded DOM browser.
    ATF will also provide for the development and incorporation for additional AJAX development tooling. ATF will use Eclipse extensions for Web application development to make the environment "server agnostic". More information about AJAX can be found in my other blog entry "AJAX and J2EE".
    They are looking for contributors as of this date.

    Popular Posts