Essentials
Once you download the extensive Struts distribution ( http://struts.apache.org ) - you
will find yourself wondering - what next? There is very extensive
documentation and also functionality.
You will be presented with an immediate decision -
Struts
1.x.y or Struts 2.x.y? Struts 1 is the traditional Struts and
Struts 2 is a new Struts merged with WebWork 2.0. I have never used
this in practice, so I cannot comment on how it would work in practice.
I have used Struts 1.x.y - 1.3.8 is the mature and stable
version with excellent effect - it eased out the entire front end
development for a large site.
It doesn't embarass me to continue working
with
existing slightly dated frameworks that I understand well and which
serve my purpose (and so I save two weeks of my life for something else
and equally valuable). The real and deeper reason is that I find Struts
1.3.8 simpler and more effective than Struts 2.0.x - software packages
have a lifecycle - and I want to continue using what I know well and
find more effective and simpler to use for my mostly simple purposes.
On this site I will discuss Struts 1.3.8. This is the
mature
and stable 1.x.y version.
If you do not have Struts you should download it for
your use.
Hello World Struts
There is lots of theory on Struts, but hard to find a
straightforward Hello World application. I have modified a file
distributed with Struts called struts-blank-1.3.8.war, called it
hellostruts.war, and made it available for your use.
The center of Struts (version 1.3.8) - is a file called
struts-config.xml. It maintains a list of names for all the
destinations in your system and lets you ask for them by name. That's
all there is to it. You will understand when you try it. There are Java
templates you have to modify in certain ways, but this is the most
central concept.
Download the following file : hellostruts.war
- and put it in your TOMCAT_HOME\webapps directory.
Start Tomcat.
Open the URL :
http://localhost:8080/hellostruts/Welcome.do
You should see a Welcome screen from your running and
functioning Struts instance.
Now, if you look at the TOMCAT_HOME\webapps directory,
you will see an entire directory called hellostruts. Go into this
directory and look at the WEB-INF\struts-config.xml file and also the
files in WEB-INF\classes, and also the JSP page in the jsp directory.
This should set you well on the road to understanding Struts and what
it is and what you can do with it. The program files have detailed
comments.
Exploring Struts
Please look at the excellent Struts documentation
on the main Struts site:
http://struts.apache.org/1.3.8/index.html
My goal is not to replicate all the excellent existing documentation on
the web - but to help you with essentials that are not that readily
available - and a Hello World Struts demonstration is one of these
essentials.
|