Expresso is the most popular architectural framework. Expresso is a robust and mature development framework built on top of Apache Struts, utilizing solid architectural principles that will accommodate from the simple projects with few users to the complex corporate high use projects. This guide will attempt to navigate the novice user through the various areas of Expresso.
Developing a web application entirely from scratch can be a massive overkill. There just isn't enough time/money in the world to reinvent the wheel every time for each web application. It is better to leverage an open-sourced framework and toolkit, like the Expresso because it has far more virtual Internet resources to help debug and maintain it - thus more robust, productive, and efficient than 'going it alone'.
Expresso is maintained and supported by many developers and users - in fact the largest framework community globally. There is the standard open source argument that OS projects are better because there are many people working on it.Most people who develop the next generation of web software prefer to build on something that already works out of the box. So now that you have completed the installation process, this document describes the Getting Started process for Expresso. Many thanks to Geeta Ramani for her ideas to this resource document.
Version: |
Expresso 5.5 |
Maintainer: |
This guide will attempt to navigate the novice user through the various areas of Expresso. Most, if not all, of which has been documented before in other documents. The purpose of this roadmap is to point you to those documents when possible and hopefully you won't have to hunt down the right document for what you need, when you need it.
Many clever developers realized that JavaServer Pages *and* servlets could
be used together to deploy web applications which became known as
Model 2. It is now commonplace to use the terms Model 2 and MVC (Model-View-Controller)
interchangeably. The servlets help with the control-flow, and the JSPs focus
on the business of writing HTML. With the release of 4.0, Expresso was
integrated with Struts, which provides a standard MVC framework to the Java
community. With the release of 5.5.Expresso is now integrated with Struts
1.1. For an introduction to Struts please read the Struts
Users Guide.
The ready-made web application is on the horizon, where you as a software developer,
professional or otherwise, will look in distaste if you had to code your own
security, database persistence layers, session management, controller, actions,
input and output, validation, and user profiling entirely from scratch. Many
users are thrilled to find Expresso because of all the complexities and tedium
it solves, and because of its rapid development capabilities. But the next question
is finding the way out from the basic starting point. This document describes
the process of taking that next step with Expresso.
By now it is recommended that you have read the Expresso
Pre-requisites and started the installation.
There are no "post-install" steps to Expresso other than connecting
to an alternate database or beginning development.
For a list of available documentation for Expresso, try the Expresso
Documentation page. This document references the links available on this
documentation page. You can also reference most of these document locally
on your system if you have the Expresso engine running on your computer,
by referencing http://localhost:8080/expresso/doc/index.html. To
faciliate this, local file names are provided throughout this document, i.e.
configuration.html. Third party resources are also links throughout this
document to provide additional learning material.
A framework is a set of prefabricated software building blocks that programmers can use, extend, or customize to suit their application. With frameworks. developers don't have to start from scratch each time they build an application: both tile design and the code of a framework may be reused. A Java web development framework is a collection of tools and API's that enhance Sun's standard Java APIs by providing:
Frameworks capture the programming expertise and best practices necessary to solve a particular class of problems and make them pervasive. In this case, it is the web centric, multi-tiered, enterprise environment that the Expresso application framework addresses. Programmers purchase or reuse frameworks to obtain such problem solving expertise without having to reinvent the wheel.
Based on feedback from some newbies, the main question a newbie asks is: "what
can i do with Expresso"? And many newbies say that though Expresso seems
to be a *wonderful* application, the amount of stuff is certainly overwhelming.
So we're going to try to make it a little easier.
Expresso is a good, powerful, flexible framework which provides a number of
services that assist in building web applications. The major areas that these
services are used are:
Before reading the Expresso Developers Guide (EDG) as a reference document, here are some questions/answers and reference material as suggested by some newbies getting started withe Expresso:
With Expresso complete it is very straightforward install. You can simplify
the server and database steps by using the Expresso Complete bundle, which
has the Tomcat servlet
container (a freely available and mature servlet runner) already bundled
and configured with Expresso. You could use any servlet runner compliant
with version 2.2 or 2.3 of the Java
Servlet API.
Without Expresso complete there is addition pre-requisites that make it straightforward
ONLY IF, you have all the pre-requisites in place. It is suggested that this
be attacked as a completely separate project, and completed before any attempt
at installing Expresso is made.
Please consult the following documents:
| Expresso Pre-requisites | prereq.html
|
||
| System Requirements | requirements.html | ||
| Expresso Installation for Complete-Bundle | expressocomplete.html | ||
| Expresso Installation Overview | installation.html
|
||
| Struts Users: Expresso Integration Overview and Reference | edg_overview.html | ||
| Frameworks for Building Component Based Applications |
Please review the "Best Practice with Expresso Framework: Using a framework to create a web application" written by Peter Pilgrim. Expresso Framework is a large toolkit of classes. Getting started can be overwhelming because there are so many classes [well over 200] to look at. This document directs a newbie's focus to the "important" classes so that is really helpful. The document also divides the framework classes into four types and discusses the roles of each of these types of classes:
It is essential that you understand the first three parts. Expresso Framework is also very much database-driven. That is, you will need to use a reliable, scalable relational database to make full use of the kit. Mysql, Sybase, Oracle, DB2, and Postgres are all suitable candidates. The document demosnstrates best practices by describing a simple stock trading program that displays stocks trades, and allows the user to buy and sell stocks. Hopefully, you can take this best of practice, using a framework, custom tag action libraries, JSP's, and Servlets, elsewhere and make it a success in your web applications.
Based on feedback from Newbies, another prominent question is: "Where
is the root of My applications supposed to be"? So we want to give an
explanation of the suggested directory structure. First you might want to
review the package
and file organization of Expresso. All Expresso apps fall under the same
context as Expresso (so the apps can use Expresso's classes).
First, a brief review of the notion of "contexts" in your servlet/JSP
container.
Your JSP container (for the sake of simplicity let say it is TOMCAT), defines a directory for web applications as it needs to know about all the contexts you have defined. This is because, when Tomcat receives a request to serve a web page, it checks the "context" of the request URI. For example, if the URI is http://www.mycompany.com/myapp/index.jsp, then the "context" is "myapp", and so it looks for the "myapp" context.
Contexts are defined in two ways: either explicitly via a definition in the container's "server.xml" or due to the presence of subdirectories within a special subdirectory called "webapps" present in the root of $TOMCAT_HOME: $TOMCAT_HOME/webapps. For example, the "default web app" is the one stored in the "ROOT" subdirectory, and is accessed via the URI "http://www.mycompany.com/". Standalone Tomcat installations usually create this default context/subdirectory as well as an "examples" context/subdirectory.
In particular, Tomcat can run multiple web applications because each web application which is a subdirectory under the "webapps" directories defines a distinct context (and can be accessed via a distinct URI).
Expresso Framework is one web application when it is properly installed: there is a subdirectory called "Expresso" in "webapps": $TOMCAT_HOME/webapps/Expresso. Thus the URI "http://www.mycompany.com/Expresso" can be considered the front page for web application, Expresso.
In keeping with this "usual" scenario, earlier versions of Expresso Framework created an "Expresso" context/subdirectory, and stored its root "frame.jsp" page in the this context (eg. in $TOMCAT_HOME/webapps/Expresso/frame.jsp for Unix) which translates to a URI of "http://www.mycompany.com/Expresso/frame.jsp". However, in later versions, the root frame page was moved to a directory further down - into another subdirectory, also called "Expresso": So for example, for Unix systems, this is in $TOMCAT_HOME/webapps/Expresso/Expresso/frame.jsp, accessible via an URI: http://www.mycompany.com/Expresso/Expresso/frame.jsp
Due to this change, you can now insert your own customised welcome page (accessed via "http://www.mycompany.com/Expresso/frame.jsp" and stored in $TOMCAT_HOME/webapps/Expresso/frame.jsp for Unix) while the Expresso pages, which may in fact be thought of as the "Administration" directory no longer "takes over" your site.
Next, we move to the question of where to put your own web apps. Since each JSP container allocates a unique class loader for each context, there are two possible ways of incorporating the Expresso Framework with your preexisting applications. We describe them both below:
Each approach has its advantages and disadvantages. The individual requirements of your applications should dictate which approach you take.
In the first case, you will have three separate & different installations
of the Expresso Framework! However, the three web applications will belong
to three distinct contexts and therfore are completely independent (and ignorant
) of each other. In particular, they can never share any application code
or sessions etc. When you publicize your web application on the Internet
you probably dont want to broadcast that Expresso is being used until you
have secured the application. You can rename the `Expresso' sub directory
to the `Expresso235' and then change the set up value `%Expresso%' in the
database. So can secure the admin site of your site. Lastly you should leave
the java classes in `%context%/WEB-INF/classes' because Java has packages
and readily support namespaces. Just call them different eg. `com.acme.work.webapp.*'
and it won't interference with Expresso's `com.jcorporate.*'.
Put your custom tag library descriptors in `WEB-INF/tlds' and your libraries
jar files in `WEB-INF/lib'. See the spec at http://java.sun.com/products/jsp/.
On the other hand, in the second case, all three of your sub-applications
share the same context and can therfore share sessions, code, state, database
pooling etc. For example, in the example above, sub-application beta can
seamlessly switch over to sub-application gamma. Further, session data stored
by sub-application beta can be picked up by sub-application gamma.
The JSP Container (Tomcat) can run multiple web applications because each one
is a subdirectory under the 'webapps' directories. With standalone Tomcat there
is at least two delivered out of the box 'ROOT' and 'examples'. The ROOT subdirectory
is special because that is the default web applicationthat you see when you
type in 'http://localhost:8080/' on your web browser. The 'examples' subdirectory
is another web application with example servlets and JSPs. The java classes
for each web application are loaded with its own class loader so that they
don't interfere with one another.
You would be well advised to take a bit of time to go through the directory structure of both the com.jcorporate.xxxx.java files, but also through the expresso .jsp files, to get a handle on how things are built before you start.
When I did this at first, I felt pretty overwhelmed, and was ready to chunk
the whole thing as being too complex. But then I look at some of the simpler
projects I have built, and see the same complexity. And then there is java
itself: At first I thought java was "just too hard," but then I grew to understand
that it is not that it is too hard, but "it just does so much." The
same seems to apply to Expresso.
Below are some references for getting started with the directory structure:
| webapps |
The directory where your servlets reside |
|||||
| - | ROOT |
The default installation root directory. This
may be named differently depending on your site specific setup. |
||||
| - | expresso |
The root directory of all that is 'browse-able'
by users hitting the website. |
||||
| - | components |
The root directory of expresso add-on
components such as ePoll, eForum, demos, etc. |
||||
| - | doc |
Documentation, papers, FAQs. |
||||
| - | help |
Runtime help for expresso features. |
||||
| - | jsp |
The Java Server Pages directly used by
the framework. |
||||
| - | xsl |
Stylesheets for XML output. |
||||
| - | WEB-INF |
The private access root directory. |
||||
| - | bin |
Scripts for testing, building, and specialty
items. |
||||
| - | classes |
Java class files and property bundles
placed in the servlet's classpath. |
||||
| - | config |
Configuration files for expresso and
any components (this includes your application). |
||||
| - | db |
HyperSonic's database directory - the
default installation's pre-configured database. |
||||
| - | lib |
All required jar files not provided by
your application server. |
||||
| - | log |
Expresso's log file destination. |
||||
| - | src |
Expresso's src code, if you downloaded
it. The code comes standard in the 'complete' distribution. |
||||
| - | tiles-definitions |
Expresso now has support for Strut's
Tiles! |
||||
| - | tld |
Tag Library Definition files. | ||||
The ROOT folder is, well, the root of the installation. Typically, this folder has no files other than a handful of no-risk HTML or JSP pages. Personally, I like to place my index.jsp here that includes files from under WEB-INF if I need to do processing. Any publically available resource, such as logo images, privacy policy, etc., can also be in this directory or sub-folder. All protected documents should be somewhere under the WEB-INF directory, as it is guarenteed to be not generally accessable by all decent servers.
NThe WEB-INF folder contains all private resources and configuration. All
servlets must have a web.xml file in this directory that specifies its characteristics. Consult
your server's documentation for information on the web.xml file. TomCat 4
ships with a well documented web.xml. The
subfolders specify additional configuration, your private resources, and
the servlet code required to run your site.
|
|
config |
The config directory initially contains
the configuration files for Struts, Expresso, and Tiles. As you
install or create additional components, they too will have one or
more configuration files here.
|
||||||||||||
|
|
classes |
Java class files, resource bundles, etc.
required by Expresso and/or your application that do not reside in
a jar file in the lib directory. |
||||||||||||
|
|
lib |
Jar files required by Expresso and your
applications. For example, you will need to add your database
driver here if you use anything other than HyperSonic SQL. |
||||||||||||
|
|
src |
Expresso source code if you have it. It
comes separate or in the 'complete' bundle. You could put your
code here also, if you desired. |
||||||||||||
|
|
tiles-definition |
Application specific tile definitions. Would
you like to know more? Even
More? |
||||||||||||
|
|
tld |
Tag library definition files. If
you use JSP and don't use tags, you're missing out on great, clean
code! Check
them out here. |
For more information on the code and CVS folder structure, read the following:
| Package and File Organization "Map" | expressoMap.html | ||
This directory is the context-path for Expresso. All of Expresso's front jsp files are located here.
The components folder is where Jcorporate will install any demo applications, and thier add-on components; eSearch, ePoll, eForum, and eContent. New users of expresso should seriously consider placing their applications here to facilitate looking at examples and it wouldn't hurt to keep them there either.
Database setup and configuration is so ubiquitous it must be mentioned in
this document. Expresso should work with most databases. See Database-specific
Installation Notes
. Specific
databases known to work are:
There are different database and Servlet engine specific installation notes onsite under the Documentation link.
Expresso can be used with any of the IDEs on the market. There are notes onsite for specific IDEs under the " IDE-specific Installation Notes" section of the Expresso Documentation.
Before anything meaningful can be accomplished with a new database (like after installation), Expresso needs to create the tables that it uses and insert the default values for its run-time. You may not like these values and you can change them.
It's fun, it's easy, get used to it because you'll be needing to run it each time you install a component!
Now for the fun stuff! Before embarking into the great wilderness that will be your destiny, it is always a good idea to see how others have done it - right and wrong. Download the example application, and you will see how simple it can be. This can be especially encouraging after you have Expresso up and can see the example application in action. Very straightforward. Below are some references for getting started with sample examples:
| Best Practice with Expresso using Struts | ||
| Understanding Expresso controller and flow control | ||
| Expresso's Users Guide | ||
| Expresso Developers Guide |
When writing your application, you will consult many of the fine documents available. It is my opinion that the following documents will be your beacon. Be sure to extensively review the setions on Inputs, Outputs, and Blocks. These are Expresso's preferred means of moving data while separating the logic from the view.
| Expresso Java Docs | /javadocs/index.html | ||
| Expresso Developer's Guide | /edg/edg.html | ||
| Expresso How To Document |
To make it easier to get rolling with Expresso, "Example" applications are available with Example documentation explaining how to access the demo applications and how to use them as a basis for developing your own applications with Expresso. You might begin with a sample application such as:
The code and relates tutorials are also available for download under the Expresso Examples Project. There is also an effort community underway onsite to develop an Expresso J2EE Pet Shop example application. This example will illustrate Sun's Java BluePrints guidelines and patterns implemented using the Expresso Framework. This sample application, when completed, will show how to use the capabilities of the J2EE 1.3 platform to develop flexible, scalable, cross-platform enterprise applications based on the Expresso Framework.
Please review the "DBMaint: A Step-by-Step Example" written by Geeta Ramani which is in the EDG DBMaint Chapter. This is an exercise which can be completed by a newbie fairly easily and I think there's always something to be said about actually getting something to work! It illustrates the writing of a simple application which allows maintenance of a customer database, complete with security. The application can be used as a beginning for a more sophisticated sales tracking application. Also, the author follows the directory structure which is discussed in this document, so that will help.
Here are some commonly asked questions about next steps and where to do
from here:
The next step after installing Expresso is to install
other applications, such as eForum or begin development. Here are some
references for beginning to develop your own application:
If you get a bug that has you hung up, it will likely get fixed very quickly with the community collaboration in which case you will want to download the daily -dev download from cvs.
Once you have some small part of your application started and are ready
to try it out, a few steps must be completed to let Expresso 'know' that
your application exists and to tie it into the framework.
| Installation of Component Applications | installapp.html |
If you get stuck along the way there are a number of resources available to help you:
Great documentation exists on Expresso. But in my experience, the best place
to be is on the forum / mailing list. Consult the documentation, read the
archives, then ask questions. The replys have always been polite, courteous,
and helpful. No disrespect to some other open source projects, but some lists
are harsh and rude to all who are clueless where to start. I have never posted,
yet I read the messages five days a week. The information floating around
there is priceless.
I hope that you have found this document beneficial. If you have, please
contribute back to the community. If you don't like it, please write it better,
or a new one. Many better writers than I exist and there is not much new
here, but I had some difficulties finding what I needed because of my unfamiliarity
with Expresso and Struts. This framework is better documented than most,
including commercial ones, and much is left to be written.
If you have all the pre-req's done, you will find that the time you need for the implementation itself is pretty small. Maybe less than a day to get it up, and another day or so to get the initial customization pointing to your own verbiage and images.
For this investment of a day, you will be shocked to see what you get, especially if you compare it to writing your own infrastructure, or even worse, writing your site in pure servlets, without a supporting infrastructure. In all newbies find it takes about 2 weeks to get fully up to speed.
Contributors to this document include: Geeta Ramani, David A. Lloyd, Sandra Cann
If you find any trouble spots with this document, or something you'd like to see clarified please contact the maintainer of this document.
Copyright © 2002-2004 Jcorporate
Ltd. All rights reserved. Copyright Privacy
Last Modified:
09-May-2004