Comments
yourfanat wrote: I am using another tool for Oracle developers - dbForge Studio for Oracle. This IDE has lots of usefull features, among them: oracle designer, code competion and formatter, query builder, debugger, profiler, erxport/import, reports and many others. The latest version supports Oracle 12C. More information here.
Cloud Expo on Google News

2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


Streamlining Application Development Using Struts in ColdFusion
ColdFusion MX supports Java objects and servlets in a big way

Although earlier versions of ColdFusion supported Java objects and servlets to some degree, ColdFusion MX does so in a big way. This support opens up commercially available libraries to ColdFusion developers that were previously only available to J2EE shops. Moreover, you can now draw from an immense library of free code from within the Java open-source community. This availability greatly enhances the features of your own applications and speeds your ColdFusion-based solutions to market. Use these objects to provide back-end processing or user-interface functionality, or simplify coding CFM pages by supplementing ColdFusion functions and tags with Java TagLibraries.

Of particular note is how ColdFusion MX hosts and runs the Apache Jakarta Project's Struts Action servlet. By implementing Struts, ColdFusion MX offers a Model-2 Model-View-Controller (or MVC) environment for ColdFusion applications. This article is based on an implementation that uses ColdFusion MX Enterprise Edition on a Windows server. ColdFusion MX Enterprise Edition includes an embedded J2EE server based on Macromedia JRun. In addition to hosting ColdFusion pages, Enterprise Edition can host JSPs and servlets. This article is also applicable to users running ColdFusion on third-party application servers, although directory and filenames will vary somewhat.

First I give a brief description of my recent project, which shows how Struts and other Java objects provided a timesaving solution to a ColdFusion project. Next I explain MVC architectures so that you can define the role that Struts plays in your application's architecture. Then you learn how to transition your own development into a Struts framework. Finally I give you a sample application to help you get started using Struts in your own environment. (Code for this article can be downloaded from http://macromedia.com/devnet/coldfusion/articles/struts.html.)

Background: Saving Time with Struts
My Company: I work for a firm that creates websites and web applications for a wide range of businesses. We support many technologies, including Java and ColdFusion. On Java projects, we capitalize on open-source projects to speed solutions to market. Over the years, we have accumulated a large library of Java applications, objects, and services.

In the Java arena, we have adopted the Struts framework for our web services. By using Struts to implement a true Model-2 MVC architecture, we can split work among our various groups. Our layout group is fluent in designing dazzling layouts using Macromedia Flash. Our business managers design conceptual business objects and workflow. Our developers use Struts to create in code the objects and flow described by the business managers. While the members of each group have great talents in their assigned areas, they require a cursory understanding of the others' ingredients to a web-based application.

Our Client: One recent client was an internal ColdFusion development shop for a large association of plastic surgeons. Their task was to create web-based services for their membership. The members use these services to promote their private practices to the public. The success of these developers is measured by the number of referrals that are driven by the website to the doctors' private practices. To do this, the association strives to be a clearinghouse from which potential patients can find the best doctor for their needs.

They run their website on Windows servers running ColdFusion MX Enterprise Edition. (They also happen to run CommonSpot, a content management package from PaperThin. They often import ColdFusion pages into CommonSpot for consistency with the rest of the site. However, CommonSpot integration is beyond the scope of this article.)

The Project: We had to create private photo galleries that users could access from a doctor's personal page. Doctors publish their most successful procedures using before-and-after photographs along with a description of the procedure. The reason for this is so that the public will view these images and be encouraged to contact the doctor's office for a consultation.

In addition, the association wanted to offer a general-purpose gallery to the public. By drawing customers to the site, the association would lead patients to a doctor's private page and hopefully generate a referral. This general gallery would be a subset of the best examples found among the members' private galleries.

This project offered us many challenges. First of all, the images were categorized by procedure, each of which had a unique HTML form to describe the patient, treatment, and results of the surgery. This form needed to be converted into a descriptive paragraph suitable for public viewing. Some form of template-technology would be required for that conversion.

Second, the images submitted by the members were typically simple downloads from a digital camera. These images came in various dimensions and resolutions and needed to be resized to standard dimensions before being stored on the servers. Additionally, photos needed to be watermarked with some sort of copyright text so discourage web surfers from appropriating them for their own uses.

Third, we needed to build in all the sorts of features you expect to find in a good online photo-gallery service: grouping, indexing, filtering, and so on.

The ColdFusion and Struts Solution: As with any business, competitive concerns and published timelines required our client to roll out these new services quickly and reliably. The services also needed to match the look and feel of the rest of the website. In addition, the workflow was still being "worked out" as development began.

By using Struts, we enjoyed all the benefits of MVC architecture: Our layout team started designing the pages that reflected the look and feel of the existing ColdFusion MX site while our developers created the Beans that maintained the photo gallery pages. They also started building the generic structures for the procedure forms. We created and modified the process flow through simple modifications to the Struts configuration file, and each team created independent timelines and contributed pieces to the project as they became available.

Java object support proved to be a great timesaver. In our private libraries, we already had a Java object that used the Graphics2D class to quickly complete the image-modification features. We implemented Apache Velocity (http://jakarta.apache.org/velocity/)to create the paragraph templates in record time. From an earlier contract, we already had a skeleton Struts service for creating a website photo gallery. In all, ColdFusion's support for Java and Struts allowed us to reuse code and work in parallel, effectively halving the time to complete the job.

(In all fairness, Macromedia technologies alone could have solved most of our requirements. ColdFusion pages, ColdFusion components, and Macromedia Flash components offer all the functionality we required. However, the ability to reuse open-source code, not to mention mine our private libraries, motivated many of our choices.)

Examining the Struts Framework's Usefulness
To understand what Struts is, it helps first to review the terms defining the Model-View-Controller (MVC) approach to application development (see Figure 1). When creating an application, the Model represents the information‹the logic‹that connects the information. To a Java developer, these roles are implemented by the storage media (such as database tables or data files) and the Beans that maintain them. To a ColdFusion developer, the model is supported by ColdFusion components and data sources.

The View is the interface used to present the model to users, or obtain input to maintain that model. To a web developer, this View is passed between web browsers and web servers as HTML pages and HTTP requests. Java developers create this interface using JavaServer Pages (JSPs), HTML, and JavaScript. ColdFusion shops use ColdFusion Pages (CFMs), HTML, and perhaps some JavaScript.

The Controller is responsible for directing traffic between and among the Model and View objects. As the View submits information, that information is passed to the Controller, which implements the proper Model object for manipulating or storing the data. The Controller might invoke a new View to provide user feedback on the Model's success or failure to process that information. Likewise, when the View requests information, the request is submitted to the Controller. The Controller calls the necessary Model(s) to get the information and then passes that information to an appropriate View object for display. How‹or perhaps I should say where‹this Controller function is implemented is what differentiates Model-1 and Model-2 implementations of the MVC design.

A full description of Model-1 and Model-2 MVC implementations can be found in Designing Enterprise Applications with the J2EE Platform, Second Edition by Inderjeet Singh, Beth Stearns, Mark Johnson, and the Sun Microsystems Enterprise Team. This book explains that in a Model-1 architecture, application flow is determined by the links embedded in the JSP or CFM pages; whereas in a Model-2 architecture, a servlet (Controller) is placed between the web pages (the View) and the business objects (the Model) to determine program flow.

So now with all that behind us, we can define Struts as follows: Struts is an implementation of the Controller functionality in a Model-2 MVC architecture.

The next logical question to ask is how do you apply these various roles of MVC architecture to the ColdFusion MX environment? And which ­ if any ­ of these architectures is appropriate for your project?

Applications created using JSP or CFM pages have a tendency to embed some of the business logic within the current page. Although it's possible to separate logic from Views, which are later combined using includes, it's not uncommon for developers‹especially during the final hours of development‹to embed small pieces of logic in the View layer. What's more to the point is that the command richness of both JavaServer Pages and ColdFusion MX allows developers to break rules. Because these types of applications are considered non-MVC conforming designs, they do not perform well over heavy loads. Non-MVC applications are perhaps most appropriate for prototypes and small-scale applications.

About Steve Belt
Steve Belt is a senior software developer for BrowserMedia, LLC, where he develops innovative software solutions for associations and finds new ways to use the Internet to make their lives easier. Before joining BrowserMedia, Steve led the development of several web-enabled tools and services used in the bioinformatics industry. Steve also participates heavily in several Java open-source projects.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Although earlier versions of ColdFusion supported Java objects and servlets to some degree, ColdFusion MX does so in a big way. This support opens up commercially available libraries to ColdFusion developers that were previously only available to J2EE shops. Moreover, you can now draw from an immense library of free code from within the Java open-source community. This availability greatly enhances the features of your own applications and speeds your ColdFusion-based solutions to market. Use these objects to provide back-end processing or user-interface functionality, or simplify coding CFM pages by supplementing ColdFusion functions and tags with Java TagLibraries.


Your Feedback
ColdFusion Developer's Journal News Desk wrote: Although earlier versions of ColdFusion supported Java objects and servlets to some degree, ColdFusion MX does so in a big way. This support opens up commercially available libraries to ColdFusion developers that were previously only available to J2EE shops. Moreover, you can now draw from an immense library of free code from within the Java open-source community. This availability greatly enhances the features of your own applications and speeds your ColdFusion-based solutions to market. Use these objects to provide back-end processing or user-interface functionality, or simplify coding CFM pages by supplementing ColdFusion functions and tags with Java TagLibraries.
Enterprise Open Source Magazine Latest Stories . . .
The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long development cycles that produce software that is ob...
The recent trends like cloud computing, social, mobile and Internet of Things are forcing enterprises to modernize in order to compete in the competitive globalized markets. However, enterprises are approaching newer technologies with a more silo-ed way, gaining only sub optimal benefi...
WaveMaker on Tuesday announced WaveMaker Enterprise, licensed software that enables organizations to run their own end-to-end application platform as a service (aPaaS) for building and running custom apps. WaveMaker Enterprise is a commercially available rapid API app development and d...
The impact of DevOps in the cloud era is potentially profound. DevOps helps businesses deliver new features continuously, reduce cycle time and achieve sustained innovation by applying agile and lean principles to assist all stakeholders in an organization that develop, operate, or ben...
The industry is heated with debates on whether adopting private or public cloud is the smartest, best, cheapest, you name it choice. But this debate is missing the mark. Businesses shouldn’t be discussing public vs. private, but rather how can they make the two work together to their g...
After the transaction closes, Eucalyptus Chief Executive Officer (CEO) Marten Mickos, a respected leader in the cloud industry and a longtime advocate of open source, will join HP as senior vice president and general manager of the Cloud business, reporting to Meg Whitman, chairman, pr...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021




SYS-CON Featured Whitepapers
ADS BY GOOGLE