Taking Java to new levels with the Macromedia MX initiative
By: Jeremy Petersen
Earlier this year, Macromedia unveiled its MX initiative. The MX initiative is billed as an "integrated family of client, tool, and server technologies" that is built on a Java foundation. Chances are most Java developers are not aware of what this means for them. In other words, as a Java developer, what can MX do for you? The answer in short is a great deal! In fact, not only can MX technology improve the speed in which you develop your Java based web applications, but it can also help you create a truly rich user experience. To better illustrate how MX technologies can compliment Java, this article will explore 2 key areas: Server-side MX technology, and client-side MX technology.
Server-side MX technology
Server-side MX technology is based on Macromedia’s ColdFusion application server. For those not aware of what ColdFusion is, ColdFusion is a rapid scripting environment- an early predecessor to JSP. ColdFusion has been around since 1995, and has developed a large and loyal following. In the past, ColdFusion would be considered a direct competitor for JSP technology, but with the introduction of ColdFusion MX, that is no longer the case. In the past, ColdFusion was a proprietary technology, but those days are gone as ColdFusion MX now sits on top of the powerful Java 2 Enterprise Edition (J2EE) platform. To date, versions of ColdFusion MX have been announced that will run on Macromedia JRun, IBM WebSphere Application Server, and the Sun ONE Application Server (formerly iPlanet). To make a long story short, ColdFusion is now part of the Java fold. More specifically, ColdFusion Markup Language (CFML) code now compiles to a Java Servlet just like a JSP. Among many other benefits, this means that now ColdFusion MX can share persistent variables with Java, use Java custom tag libraries, objects, EJB’s, etc.
So far this sounds like a great deal for ColdFusion developers, and it is. But what about Java developers? What does ColdFusion MX do for you? ColdFusion has many features that are well worth documenting, but without turning this article into a full-blown ColdFusion marketing piece, we will focus on 1 single reason why you may want to use ColdFusion to compliment your next Java based application. This single reason we will focus on is the fact that ColdFusion is a Rapid Application Development (RAD) technology. Simply put, ColdFusion is very easy to learn, and very easy to code, and in most all cases empowers you to code using fewer lines of code then any other technology available. These are bold words, but they are easy to prove with some code samples. Lets take three common tasks and see what they look like in CFML code. The three tasks we will use are: Reading a text file and displaying the results, querying a database and displaying the results, and both exposing and consuming a web service.
Reading a text File and displaying the results
<CFFILE
ACTION="read"
FILE="MyText.txt"
VARIABLE="myFile">
<CFOUTPUT>#myFile#</CFOUTPUT>
Querying a database and displaying the results.
<CFQUERY NAME="Company"
DATASOURCE="yourDB"
USERNAME="username"
PASSWORD="password">
SELECT VendorID, VendorName
FROM tblVendor
ORDER BY VendorName
</CFQUERY>
<CFOUTPUT QUERY="Company">
#VendorName#: #VendorID# <BR>
</CFOUTPUT>
Exposing a web service using CFML*
<CFCOMPONENT>
<CFFUNCTION NAME="echoString"
RETURNTYPE="string"
OUTPUT="no"
ACCESS="remote">
<CFARGUMENT NAME="input" type="string">
<CFRETURN arguments.input>
</CFFUNCTION>
</CFCOMPONENT>
* The WSDL is automatically generated by ColdFusion, so this is really all there is to it!
Consuming the above sample web service using CFML
<CFINVOKE
WEBSERVICE = "URLtoWSDL"
METHOD = "echoString"
INPUT = "Hello World!"
RETURNVARIABLE = "results">
These quick samples show how easy it is (and how few lines of code it takes) to use CFML. So how might you capitalize on the RAD capabilities of ColdFusion MX in your next Java project? Some ideas that come to mind include:
- Coding proof of concepts, or smaller projects that don’t have a large design or development time budget.
- If you are using a tiered approach for larger applications, ColdFusion MX is the perfect technology to use for displaying logic and encapsulation layers.
- Working in less experienced developers who may face a sharp learning curve with Java.
- Bypassing JSP’s completely.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|