Getting Started with WAP and WML

Download Report

Transcript Getting Started with WAP and WML

Marrying Java &
Charles Arehart
Founder/CTO, Systemanage
[email protected]
Getting Started with WAP and WML
© 2001 Charles Arehart,
• Considering Java as an alternative
• Integrating CF and Java Today
– CFOBJECT, CFX_ Custom tags, CFServlet
• Jrun and Java Application Servers
– JSP/Servlets, EJBs, and more
Future integration possibilities for CF’ers
TagServlet from
Software Needed
Learning More
Getting Started with WAP and WML
• Intended primarily for those with:
– ColdFusion experience
– Aware of Java and its value to application developers
• No need for java experience
• Enterprise integration experience not necessary
• Anyone interested in:
– Learning about Java integrating ColdFusion & Java
– Extending CF into existing enterprise applications
– Will likely come away capable of doing it immediately
Getting Started with WAP and WML
Who Am I?
• A programmer by trade, trainer at heart
– with nearly 20 years IT experience
• 4 years ColdFusion, 1 year server-side Java
– Monthly contributor to ColdFusion Developer Journal
– Speaker at user groups, conferences worldwide
– Allaire Certified Instructor & Developer
• Best practices, performance tuning
– Contract mentor to development teams
Getting Started with WAP and WML
Our Goal
• Java integration is both simple and broad
– Can’t expect to cover everything today (or even an
entire week)
• Not even a single book can capture it all
– Will introduce most important topics
• Get a flavor for opportunities, challenges
• Understand fundamentals
– Will discuss
• How to begin
• Explore resources for learning more
Getting Started with WAP and WML
Considering Java as an
• Java: it’s here & it’s big
• May have been feeling pull
– May have been able to “fight” getting into it
– Time has come to face the truth
• A large market is demanding Enterprise java solutions
• Not really about caving in
– Learning how and when to best leverage Java as a CF
– Not necessarily leaving CF for Java
– More about how to best marry the two
• Getting easier all the time
• Free to get started
– Most platform tools are free, for developer level
Getting Started with WAP and WML
Why Bother?
• Benefits for current projects
– Leveraging java library functions for quick needs
– Creating new classes to extend functionality
– Accessing existing apps/modules within enterprise
• Whether written in java (as classes, EJB’s, servlets)
• Or made available by way of it (CORBA)
• Benefits as a professional developer or
development firm
– Lots more clients clamoring for JSP/servlets than CF
• Still plenty of market for CF, just larger for JSP/servlets
– Skills learned in working with Jrun migrate for the most
part to other java application servers
• IBM Websphere, BEA WebLogic, Apache TomCat
Getting Started with WAP and WML
What Can Java Give Us?
• Among the things Java can offer CF
developers, besides primarily Enterprise
integration include:
Stronger string manipulation
XML manipulation
Graphics generation
Image creation and manipulation
PDF creation and formatting
• Allaire Tag Gallery and Sun site offer
downloadable examples of such things
Getting Started with WAP and WML
Integrating CF and Java Today
• CFOBJECT for Java
– Used to call upon java classes available on the same
server running CF
• Can be used to leverage java language
• Or to access existing business objects, including EJB’s
• CFX_ Java Custom tags
– Similar to calling via CFOBJECT
• Typically used to leverage CF integration within the Java
class (accessing/updating CF variables, queries, etc.)
– Like CFX’s in C++, can leverage the CFX API
• CFServlet
– Used to integrate with servlets
• Either obtaining the output of the servlet
• Or creating means to pass data to servlet which it can
Getting Started with WAP and WML
Simpler Forms of Integration
• Keep in mind that servlets (and JSPs) can
also be called from within CF templates just
as regular HTML pages could:
<A href>
<form action=>
<img src>
Getting Started with WAP and WML
Installation Support for Java
• To leverage CFOBJECT for Java and CFX
– you must have 4.5.1 of ColdFusion
– Must have Java Runtime Environment 1.2
– Must configure CF server Admin to setup classpath
and other parameters
• Critical points are
– JVM path: where JVM is installed
– Classpath: where your classes will be stored
– CFX_jar path: where cfx.jar for CFX’s will be stored
• See “A Cold Cup O’ Joe” Part 1
– Jan 01 CFDJ
– Great discussion of setup issues, challenges
• See later slide “Software Needed” for how to
obtain software, versions, etc.
Getting Started with WAP and WML
• New support in 4.5 for CFOBJECT
– Also createobject() function for use in CFSCRIPT
• Allows call to java objects
– There are even graphing objects that can be called
• Fairly easy to demonstrate simple example
– Just need to know its methods and attributes
Getting Started with WAP and WML
CFObject (cont)
• For more complex uses
– Need to understand calling an object’s default
constructor or overloaded constructors
• Does not currently support overload by attribute datatype
– Great discussion in “Cold Cup O’ Joe” Part 3
• April 01 CFDJ
• Can also be used to call Enterprise Java
– Demonstrated in Allaire “Developing Applications with
Jrun”, chapter 42
Getting Started with WAP and WML
CFX_ Java Custom Tags
• Similar to calling upon objects
– The class that is called can read/manipulate CF
• Variables, queries
• See simple example
– Can also pass it attributes
• Processed with request.getAttribute in class
• See simple example
• Must be registered in the CF administrator
– Then called as <cfx_ojectname>
• Available Debugging option
– See simple example
• May hear of old way of doing this, CFX_J
Getting Started with WAP and WML
Java CFX Interface
• Several available methods, attributes for
developing java Custom Tags
– Query interface
– Request Interface
– Response Interface
• See “Developing Web Apps” for details
– Chapter 18
Getting Started with WAP and WML
• Only works with Jrun
• Allows call to servlet running under Jrun
– Need only know
• Server’s IP address, if not same as CF server
• Jrun Port (Jrun and other app servers use unique ports to distinguish
from web server)
• Servlet name
– <CFSERVLET code="SimpleServlet"
• Optional WriteOutput=“yes/no” attribute
– If no, output of servlet is written to CF output stream
– If yes, written to Cfservlet.output variable
• Optional Debug=“yes/no” attribute
– Can write to a Jrun-specific event log file
• May hear of old way of doing this: CF_Servlet
Getting Started with WAP and WML
• Allows passing data by value or reference
– By value:
• <cfservletparam name=“servletparm” value=“value”>
• Available to servlet as “parameter”
• Changing parameter in servlet has no effect on CF variable
– By reference:
<cfservletparam name=“servletattr” variable=“CFVarname”>
Optional “type” attribute to help CF tell java the datatype
Available to servlet as “attribute”
Changing attribute value in servlet will change CF variable
Getting Started with WAP and WML
Message Passing
• When considering communications between
CF and java components, consider XML
– XML provides powerful means to pass structured data
between disparate systems
– Need not be Allaire’s WDDX format
• If you control the two systems talking to each other, you can
create your own meaning in the XML
– See “Online Ticket Store” in Jan 2000 CFDJ
Getting Started with WAP and WML
Jrun and Java Application
• Jrun is a Java Application Server
– And a very well respected one, at that
– Reasonably priced, free developer edition
• Others include
– IBM Websphere
– BEA Weblogic
– Apache TomCat
• Enables execution of Java Server Pages,
– JRUN also includes features to run EJBs, and more
• JSP’s ease entry into Java world
Getting Started with WAP and WML
Java Editors
• Big difference between JSP editor and Java
Servlet/Class editor
– CF Studio can act as JSP editor
• Knows about JSP tags, etc.
– Kawa is a real Java editor
• Can compile things, debug, etc.
– Jrun Studio is a hybrid
• Adds ability to compile to CF Studio interface
• Not nearly as powerful as Kawa for real Java editing
– Other java editors don’t likely support JSP’s/servlets
• Visual café, Visual J++, etc.
• JPadPro available as shareware
Getting Started with WAP and WML
Future integration possibilities
for CF’ers
• ColdFusion 6, a.k.a Neo
– Changing CF from running on a C++ platform to
running on a Java platform
– Does NOT propose to change CF developers into
Java developers
• CF templates will run unchanged
• Under the cover, will be turned into Java Servlets
– Will further open integration possibilities
– More important for Allaire
• Allows them to leverage the Java platform
– And many features that they currently must build from
scratch to make CF as powerful as it is
Getting Started with WAP and WML
TagServlet from
• Very similar to proposed Neo approach
– But works today
• Can process a ColdFusion file and turn it into
a servlet to be executed
– Has more limited tag support than Neo proposes
• Is improving all the time
• Currently in beta, will eventually be sold
• Called TagFusion for a time
Getting Started with WAP and WML
Getting to EJB’s
• By now can see at least 2 routes to EJB’s
– CFOBJECT direct call to EJB
– CFSERVLET call to servlet, that calls EJB
• In case such interaction already exists and don’t want to code
more direct route
Getting Started with WAP and WML
Software Needed
• To do any java integration, need Java
Runtime Engine on server
– Can obtain free from
• To run Jrun or do JSP/servlet integration, will
need a Java application server
– Allaire offers free 3 person developer edition
– Will need Java 2 EE (J2EE) SDK on top of that
• Also free from
– Other java app servers from IBM, BEA (,
Apache Tomcat (
• To do EJB integration, need EJB server
– Jrun provides that, as do other products
• ColdFusion 4.5
– added java custom tags and CFObject support for java
Getting Started with WAP and WML
Learning More
• Many CFDJ articles
– Especially current 8 part “Cold Cup O’ Joe” series by
Guy Risch
– 3 part “Java for CF’ers” series by Ben Forta
– 6 part “Online Ticket Store” series by Ajit Sagar
• 4 parts of which were in Java Dev. Journal
• Allaire documentation
– CFObject, CFX_ custom tags, CFServlet
– Language Reference and “Developing Web Apps”
– Administering CF (for admin setup)
• Excellent Allaire Jrun documentation
– Download the Allaire Jrun 3-user demo
– No time expiration
Getting Started with WAP and WML
Beware of Some Books
• May focus on teaching servlets/JSP to java
– Focus more on showing them how to do web
application development (stateless programming,
passing data from URL’s and forms, etc.)
– Presume that reader already knows Java
• Java Books often focus too much on clientside Java (applets, Swing)
– Not as relevant to us interested in server-side java
Getting Started with WAP and WML
For Further Questions
• For follow-up questions
– Or more information on Java or ColdFusion consulting, training,
or presentations
• Please contact:
Charlie Arehart, CTO, Systemanage
[email protected]
(voice) 301 604 8399
• Available for training, mentoring, short-term
consulting (1-5 days):
All manner of CF topics, beginner-adv
Maximizing developer productivity
Best practices, performance tuning
Database design, Int/Adv SQL topics
Testing, Source Code Control, and more
Getting Started development
with WAP and WML