- Ajax: A New Approach to Web Applications: This is where it all started (to be specific, the name - AJAX).
- 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.
- Mastering AJAX is an ongoing series on IBM Developerworks by Brett McLaughlin which introduces the central concepts of Ajax, including the XMLHttpRequest object.
- AJAX with J2EE: A sub-section in the Java blueprints on AJAX with Java Server Faces (JSF).
- AJAX patterns: An Ajax portal and homepage for the upcoming "Ajax Design Patterns" book (O'Reilly), with full text online
- AJAX Lessons: Simple AJAX tutorials and news.
- AJAX Freaks: This website exists to provide you with information to use while learning or developing AJAX.
- **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.
- AjaxTags: A JSP tag library with some easy to use widgets for creating Ajax-enabled Web Forms.
- Here are my old blog posts related to AJAX:
- AJAX and J2EE: My first post on AJAX and how it relates to J2EE.
- AJAX Toolkit Framework for Eclipse: About the AJAX toolkit framework project for eclipse.
- AjaxTags for Java Server Pages: Overview of AjaxTags.
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
Tuesday, February 21, 2006
Glassfish
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
ConcurrentModificationException
If you try to modify a list while iterating through it, then you will encounter the ConcurrentModificationException. This is described in the code below
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
List<Integer> intList = new ArrayList<Integer>();
try {
for(Integer i:intList) {
System.out.println(i.intValue());
if(i.intValue() % 2 == 0)
intList.remove(i);
}
} 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 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.
while(iter.hasNext()) {
int j = iter.next();
if(j%2 == 0) {
iter.remove();
}
}
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)
intList.remove(i);
}
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)
intList.remove(j);
}
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
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.
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.
VERBOSE GARBAGE COLLECTION
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 JVM HEAP SIZE
Change the heap size so that the GC cycle.
CHANGE CONNECTION POOL SIZE
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.
TURN ON SERVLET CACHING
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.
MODIFY THREAD POOL COUNT
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.
VERBOSE GARBAGE COLLECTION
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 JVM HEAP SIZE
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.
CHANGE CONNECTION POOL SIZE
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.
TURN ON SERVLET CACHING
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.
MODIFY THREAD POOL COUNT
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
They are looking for contributors as of this date.
AJAX Toolkit Framework (ATF) will provide extensible frameworks and exemplaryThe initial set of tools built on these proposal will include:
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.
- 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.
They are looking for contributors as of this date.
Subscribe to:
Posts (Atom)
Popular Posts
-
In a previous post, I described how to use Quartz scheduler for scheduling . In this post, I describe the configuration changes required for...
-
JUnit 4 introduces a completely different API to the older versions. JUnit 4 uses Java 5 annotations to describe tests instead of using in...
-
This post will describe how to create and deploy a Java Web Application war to Heroku using Heroku CLI. You will need a basic understanding ...
-
New posts with iText 5.5.12 Following are two new posts for PDF Merge with iText 5.5.12 Merge PDF files using iText 5 Merge and Paginate PDF...
-
This is an example code for a simple PDF merge using iText 5. We use three InputStream s in a List as input and merged file is written to th...
-
Big Faceless Report Generator is a commercial Java API for generating PDF files from XML input . The report generator is built on the Big F...
-
The previous post described how to implement a JMS messaging client using Spring JMS . This post will describe how to implement the Message ...
-
Displaytag is an opensource tag library that can be used to display tables on JSPs. Apart from being able to display tables, the displaytag...
-
Last week, I described how to implement JMS, using a stand-alone client and a Message Driven Bean . In this post and the next, I will descr...
-
In this post we will see a way to merge multiple PDF files while adding page numbers at the bottom of each page in the format Page 1 of 10 ....