★ wanayoo — archive 1999 http://java.webdeveloper.com/tutorials/WebAppSTRUTS/index.htmlNouvelle recherche | Portail wanayoo


Find a Web Host With:
CGI Access
DB Support
NT Servers
UNIX Servers
Telnet Access

advanced search
Internet News
Internet Investing
IT
Windows Technology
Linux/Open Source
Developer
Interactive Marketing
xSP Resources
Small Business
Wireless Internet
Downloads
Internet Resources
Internet Lists
International
EarthWeb
Career Resources

Search internet.com
Advertise
Corporate Info
Newsletters
E-mail Offers
Be a Commerce Partner
Find a Consultant
Website Monitoring
Find a Web HostFind a Web Host
Internet Jobs
Free Barter Account
Promote Your Website
Breathing Problems?
Shop For Computers
Build an Online Store
Best Deals on PDAs!
FlashKit
Gif.com
HierMenusCentral
JavaBoutique
JavaScript.com
JavaScriptSource
WebDev Jobs
JustSMIL
ScriptSearch
StreamingMediaWorld
Web Hosts
WebDevelopersJournal WDVL
WebDeveloper.com
WebReference.com
XMLFiles.com
CGI
HTML
Java
JavaScript
Web Design and Promotion
Web Site Development
E-mail Address:


Can you receive
HTML e-mail?

Yes   No

Zip Code:


Tutorials : Building a sample Web App with STRUTS:

Building a sample Web App with STRUTS

by Harshal Deo

A few years back I wrote an article on 'Building Sample Web App with Servlets & JSP'. A lot has changed since then. In this article, I will discuss building a sample web application using STRUTS. STRUTS is a leading open-source Web Application Framework. A lot has been written about it and if you want a detailed introduction, please read The Introduction To STRUTS
Articles. NetBeans is the leading open-source IDE and we will use it to demonstrate how to simplify application development using the IDE. Finally our application will run on TomCat application server.

For this article we will use the following versions:
STRUTS 1.1 Beta 3 , NetBeans IDE 3.4.

Prerequisites:

We will assume that as a reader you are familiar with web application development, specifically using JSP and Java.

Preparation:

We need to install NetBeans IDE (and JDK needed for the IDE). You can install NetBeans from www.netbeans.org. Or click here for simple instructions on how to install the IDE.

Quick overview:

We will create a very simple web application just to demonstrate screen flow and action handling using STRUTS. We will use NetBeans to create the JSP aNDjava files, use tools such as auto generation of getters and setters and finally use the IDE to compile and test the app. NetBeans comes with integrated TomCat.

The application will just have two pages. A Start page where you enter your name and a results page that will display a personalized welcome message.

Ok, so let's get started.

1. Download the Quick start Zip File from here and extract it to any directory. It should create this directory structure:

StrutsNetBeansSample
	/META-INF   (Some meta info - ignore for now)

/WEB-INF  (Main dir. For our web app - 

the TLD files are struts tag libraries. Also there are 2 config files) /Lib (Struts.jar - the struts framework jar file) /Src (Here we will keep our sources ) Under this we have dir structure com/openstack/struts/testapp /Classes (Here we the built classes will be stored)
Note: Normally the struts.jar , tld and config files will be downloaded from Struts website, when you download and install STRUTS. These are provided here just for the 'quick start'.

2. Start NetBeans and mount this directory(In netbeans, right click on filesystems in editor window -choose the 'local directory' option and choose the directory: StrutsNetBeansSample). After you successfully mount the directory the editor window will show the StrutsNetBeansSample directory and underlying WEB-INF/classes directory as two separate entries. If not then mount those directories separately. At this point you can now switch to the 'project' window in NetBeans if you prefer that view - the 'alternate' view.

3. Now let us create our first JSP - a Test Form. A sample JSP is provided under the quickstart directory. Create the TestForm.jsp under the document base (StrutsNetBeansSample) directory. It should look like this:

< %@ page language="java" % >
< %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
< %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
< %@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

< html:html>
< head>
< title>test form < /title>
< /head>
< body bgcolor="white">
< B> This is a template STRUTS APP< /b>
Please enter your name:
< html:form action="/old?u=http%3A%2F%2Fjava.webdeveloper.com%2FTestAction&y=1999">

      < html:text property="ipString" size="50"/>

      < html:submit property="submit" value="Submit"/>
< /html:form>
< /body>
< /html:html>



[Next]

Harshal Deo has 10 years of experience working with enterprise systems. He has worked with companies like Citicorp & KPMG and currently works for an enterprise software company Asera. Previously he has worked with a valley startup MHP, as a lead Architect, defining the application architecture of its J2EE based system. He has also published a few articles on technology and related areas.

Harshal is also one of the founders of www.theopenstack.com--an online community, simplifying and promoting the use of open source technologies for enterprise application development.


Applet Index
(sorted alphabetically)

A B C D E F G H I J K
L M N O P Q R S T U
V W X Y Z #s
The Java Source
(applets w/source code)

A B C D E F G H I J K
L M N O P Q R S T U
V W X Y Z

How to Add Java Applets to Your Site

New on the Java Boutique:

New Article:
Struts in Action
The newest book excerpt from "Struts in Action" covers validators, bundles and configuration files.
... [more articles]

New Tutorial:
Converting XML documents to Java objects with Castor XML
If you're working with XML documents, and your focus is more on the contents of the documents, and not so much on the XML structure, then Castor XML may be what you're looking for. This month Keld Hansen focuses on the conversion capabilities of Casto XML.
... [more Tutorials]

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.

internet.com logo




Developer News

Just Another Worm on the IRC

SCO Faces Hurdles in Linux Claims

Sun Preps Another J2EE 1.4 Beta



Database Journal Launched!
Jupiter Media has announced the launch of Database Journal. DBJ offers SQL courses and other database related resources for beginner to expert developers.



Gaming Tools
A simple framework to enable you to quickly take advantage of full-screen animation, music, and sound effects without learning all the intricate details of the new Java 1.4 APIs.
Download of the Week
X Images
This is an Image Show applet. All images have a URL. If you double-click on an image you go to that url with specified frame.

JB User Poll
As a JavaBoutique Reader what kind of articles do you prefer?
The JavaBoutique Top 15:
1. ChompText
2. DJPopMenu
3. PingPong
4. RushHour
5. NavBar
6. 3DMaze
7. AnimLetters_anim
8. AnimatedTreeControl
9. BSCOutline
10. Encyclo
11. AScroll2
12. Distorter
13. Viewer
14. BMMenu
15. Nibbly
Want more? Check out our Top 100!

Refer-It
Affiliate Program and Referral Directory.
New on internet.com
Ultra Wideband: Gaining Momentum
A year after getting the FCC green light, UWB technology will be found in electronic products under this year's Christmas tree.

2002 Worst Year for IT
With the exception of the Asia Pacific region and Japan, IT services took a big hit, but enterprise spending and middle market software purchases could fuel the rebound.

Storage Product of the Year -- StorageTek T9940B
Storage peripherals may not be the most compelling of IT products, but they are necessary nonetheless. With that in mind, Datamation voters made this tape drive a winner.


Copyright 2003 Jupitermedia Corporation All Rights Reserved.
Legal Notices,  Licensing, Reprints, & Permissions,  Privacy Policy.
http://www.internet.com/