★ wanayoo — archive 1999 http://java.webdeveloper.com/tutorials/Building_WebApps/Nouvelle recherche | Portail wanayoo
Computer Digital Expo

The Enterprise IM Strategies & Solutions Event


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
Track Defects Online
Internet Jobs
Register Domains
Reach IT Professionals
Conference Calling
Find a Consultant
Find a Web Host
IT Training
Shop For Computers
Send a Press Release
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:


Reviews :

Building a sample Web App with STRUTS Part 2 :

By Harshal Deo & Keerti Pai

Adding database access to the sample web app.

Pre-requisite:

Before starting this you should have completely read part 1: Building a sample Web App with STRUTS For easy reference, the complete code for this article is available at The Open Stack website look for the Part 2 ZIP file.

Quick Overview:

In this article we will demonstrate database access from the STRUTS Action class. We will use the 'iterate' tag from the STRUTS tag library to display the contents of a table on the web page. Finally, we will add a simple error handling to the application.

In part one, we developed two screens (JSPs) and the Action class. The TestForm had a simple form to take an input String and pass it to the Action class. The Action class constructed a Welcome message and displayed it back on the TestResult page.

In this article we will modify that application to "search" for employees from a database, based on the input search String. The database will store employee records and our app will allow a simple search on the short name "abbreviation". Our assumption is this short name "abbreviation" is sort of like a user ID used for system accounts and email addresses etc. The search will return the first name , last name along with the short name abbreviation from the records that match the search criteria.

NOTE: This is just an attempt to demonstrate the database access from STRUTS, not necessarily a "Best Practice". For a simple web application that does not have much transactional/persistence requirements this surely is a quick and easy way. As next steps, one could separate the Database access code from the Action class and/or use JDO or a similar product like Castor. Please look at The Open Stack Project for further details on these approaches.

Preparation:

For the database access part, you need to have a test database ready along with the JDBC driver to access this. For completeness of the article, we will demonstrate using a MySQL database and the corresponding JDBC (2.0) driver. If you are using a different database/driver, then please ignore the parts related to MySQL.

Optional: MySQL database setup

Download and install MySQL from here. Once you have installed the server (you can follow all the default steps in graphical install tool for easy setup), start the server. It could be as easy as going to the 'bin' directory under the MySQL install directory and executing the server executable such as 'mysqld-nt.exe'.


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:
J2EE Deployment Specification
Why is it that J2EE applications written in the same language, Java, may not coexist on different servers? While the answer isn't simple Sun has set out to alleviate these problems with the "J2EE Deployment Specification".
... [more articles]

New Tutorial:
Designing Packages for Stability
Are your designs stable? This month Samudra will focus on the change impact relationship involved in designing classes showing us how to take them into account when designing the package relationship.
... [more Tutorials]

Year in Review:
The Best of 2002
The year 2002 saw 201 new applets posted to JavaBoutique. Check out the 2 most popular apps from each month of 2002!
... [popular applets]

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

Deadline Looms for IBM's AIX

HP, Dell Pledge Java Support

Putting Java in ONE Cup



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.



PhotoMap
PhotoMap is made of many pictures and links. You can travel in "photo map world" where you have never visit yet.
Download of the Week
BSCOutline v5.10
BSCOutline Java Outline Applet is a customizable tree view control for use in Web pages, similar to that used by Windows File Manager or Explorer. BSCOutline has been written to be the simple to use and small to store.

JB User Poll
How does .NET fit into your programming?
The JavaBoutique Top 15:
1. Webmatic
2. ChompText
3. PingPong
4. DJPopMenu
5. RushHour
6. Distorter
7. NavBar
8. 3DMaze
9. AScroll2
10. Nibbly
11. AnimLetters_anim
12. Encyclo
13. BMMenu
14. BMI
15. Viewer
Want more? Check out our Top 100!

Refer-It
Affiliate Program and Referral Directory.
New on internet.com
HP, Dell Pledge Java Support
Despite Microsoft's decision to drop Java from the Windows OS, HP and Dell say they will continue to ship the runtime environment as part of their OEM agreements.

Case Study: Tradeshop.com
This online jewelry craftsman focuses on one-on-one customer service, using an old-fashioned small business approach to create e-commerce success.

Information Technology in Context
Nicholas Carr's article in the Harvard Business Review has stirred up a firestorm of controversy about the relevance of IT to business strategy. Columnist George Spafford says before people completely discard what Carr has to say, there are some issues to take into account.


The PC, Console and Hand-held Game Business Event

Jupitermedia Corp. is publisher of the internet.com and EarthWeb networks.
Copyright 2003 Jupitermedia Corporation All Rights Reserved.

Legal Notices,  Licensing, Reprints, & Permissions,  Privacy Policy.
http://www.internet.com/
http://www.earthweb.com/