Tuesday, November 29, 2005

Sprinkle Some AJAX Magic in Your Struts Web Application

If you've used Struts for a long time, you're probably used to sending static pages back to the client. AJAX offers a much richer browser experience, without requiring a complete refresh every time the user does something. Paul Browne shows how you can incrementally add AJAX functionality to an existing Struts application, without having to rewrite the server side to accommodate the changed client. Read the entire article on java.net.
Technorati Tags: , , ,
Blogs linking to this article

Sunday, November 27, 2005

JBoss Tip

Tomcat 5.5.9 is the default servlet container included with JBoss 4.0.2. It is deployed as a SAR (Service Archive) in $JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar.

Thanks to the modular design of JBoss, swapping out Tomcat for another servlet container is easy. Jetty is another option that is fast, mature and open source. Download a pre-build SAR, ready to drop in and run.

Hat Tip: O'Reilly's JBoss at Work: A Practical Guide by Tom Marrs and Scott Davis.
Technorati Tags: , , , , ,
Blogs linking to this article

Friday, November 25, 2005

Building Rich Internet Applications using Laszlo

Laszlo is an open source XML-native platform for building Rich Internet Applications. Laszlo applications are written in the XML-based language LZX (XML and Javascript). These applications run on all leading Web browsers on all leading desktop operating systems. Frameworks like Struts handle the flow of an application on the server, while technologies like Laszlo push that logic to the client. Instead of the constant click-refresh of a html web application, data is only sent to the server when needed. The client decides how to paint itself at each instance instead of the server making that decision.

The OpenLaszlo SDK consists of a compiler written in Java, a runtime JavaScript library, and an optional Java servlet that provides additional services to the running application. The compiler compiles LZX source files (these are well-formed, valid XML documents) into executable binaries for targeted run-time environments. The OpenLaszlo platform currently targets the Flash Player. Users of OpenLaszlo applications require a Web browser with Flash 5 or later installed.

Laszlo Architecture
OpenLaszlo Server is a Java application that executes in a J2EE servlet container. The OpenLaszlo Server may communicate with back end servers and data sources using a variety of protocols. Laszlo applications written in LZX are compiled by the OpenLaszlo Server and served as bytecode to a plug in that runs in the client's web browser. This constitutes the front end. The currently supported run-time environment, the Flash 5 or higher plug-in, executes consistently and reliably on a variety of operating systems and device types, including Windows, Pocket PC, Mac OS, Linux, and Solaris, and a variety of mobile and set-top box platforms. The OpenLaszlo Server outputs bytecode in the SWF file format recognized by the Macromedia Flash player (version 5.0 and higher - The Flash player is used solely as a rendering engine). Nothing in the Laszlo architecture binds it to Flash, however. In the future, Laszlo may support other run time clients as they become widely available.

In the Laszlo context, client means LZX application executing in user's web browser, and server means OpenLaszlo Server (which may, in turn, communicate with other servers). The LZX client and OpenLaszlo Server server communicate over HTTP; the OpenLaszlo Server sends byte code and the LZX application sends XML

Some important links:

Architecture

Laszlo Application data flow diagram

Downloading Laszlo

Installing the Laszlo Dev. Kit - You need JDK 1.3+ and you should set the JAVA_HOME

Testing your installation

Documentation

Tutorial 1
Tutorial 2
Tutorial 3

Laszlo Book

Laszlo Forum

A sample Laszlo White Paper - Online Retailing Solutions
Technorati Tags: , , , , , , ,
Blogs linking to this article

Monday, November 21, 2005

PuneJava Meet 2005

I am just back from the PuneJava Meet at the Maratha Hall, Hotel Sun and Sand, Pune (held on Sunday, 20th Nov. 2005) and it was a grand success.

The first session was by Ashish Kulkarni on Apache with JBoss. His presentation is available for download from our PuneJava Yahoo groups File section.

The second session was by Harshad Oak on 'Java Trends'. He mainly talked on:
  • AJAX
  • SOA
  • EJB3
  • Scripting Languages
You can download his presentation on Java Trends'.

A big thank you to Ashish Kulkarni, Harshad Oak and Girish Nadkarni.
Technorati Tags:
Blogs linking to this article

Thursday, November 17, 2005

Tip - Internationalization using JSTL: locale

When a user sends a request to your server, the user's browser uses the URL information to create a request message. Amongst other information, the request message contains an Accept-Language header that provides information to the server about the preferred languages. This helps the server to localize the application. We can use JSP Standard Tag Library (JSTL) to find the locale (represents a particular geographical, political, or cultural region) of the user.

The Expression Language (EL) is geared towards looking up objects and their properties, and performing simple operations on them. pageContext is a JSTL implicit object, that has a property named request, which in turn has a property named locale. The follwing JSP page extracts the local information of the user.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body bgcolor="white">
The Locale used by this PC is <c:out value="${pageContext.request.locale}" />;
</body>
</html>

Technorati Tags:
Blogs linking to this article

Tuesday, November 15, 2005

EAR file

An Enterprise Archive File (EAR) is a convenient way to bundle up all the pieces of a full-fledged J2EE application. An EAR keeps everything organized.

An EAR can contain at least one of any of the following modules. You can safely omit any of them, if they aren't needed.
  • Web module - A WAR file containing presentation tier components
  • EJB module - An EJB JAR file containing the middle-tier components (EJBs)
  • Java module - A regular JAR file containing classes and libraries that are shared across the entire application. An application client JAR and a common JAR are two examples
    of Java modules
Application.xml Just as a WAR file contains a web.xml deployment descriptor, an EAR file contains a file named application.xml. It is essentially a packing list, telling the J2EE server exactly what files the EAR contains and where you can find the files relative to the root of the EAR. The EAR file's META-INF directory stores application.xml.

An example application.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
version="1.4">
<display-name>JBossAtWorkEAR</display-name>
<module>
<web>
<web-uri>webapp.war</web-uri>
<context-root>jaw</context-root>
</web>
</module>
<module>
<java>common.jar</java>
</module>
</application>
The elements in application.xml should be pretty self-explanatory. We are telling the application server the name of each JAR and what function it serves. Notice that Web modules allow you to specify one other value - the <context-root>. The context root is your web site's URL. If you deploy a simple WAR file, the name of the WAR will be used as the URL. When your WAR file is deployed inside an EAR, this element allows you to override the physical name of the WAR and use whatever URL you'd like.

Hat Tip: Oreilly's book: JBoss at Work - A Practical Guide by Tom Marrs & Scott Davis
Technorati Tags: ,
Blogs linking to this article