Learning Jakarta Struts 1.2
📖 eBook - ePub

Learning Jakarta Struts 1.2

Stephan Wiesner

Share book
220 pages
ePUB (mobile friendly)
Available on iOS & Android
📖 eBook - ePub

Learning Jakarta Struts 1.2

Stephan Wiesner

Book details
Book preview
Table of contents

About This Book

The book sets out to get Java developers up to speed and confident with Struts as quickly as possible. It does not explain every feature in Struts, but takes a logical path through the essential information, with the emphasis on practical applications. This book is written for Java developers planning to develop web applications, who are new to Struts. It expects familiarity with Java, JSP and Servlets to a degree, although more obscure elements are explained. It covers Struts 1.2.

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.


Learning Jakarta Struts 1.2

A concise and practical tutorial

Stephan Wiesner

Learning Jakarta Struts 1.2

Copyright © 2005 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2005.
Published by Packt Publishing Ltd.
32 Lincoln Road
Birmingham, B27 6PA, UK.
ISBN 1-904811-54-X
Cover Design by www.visionwt.com
Authorized translation from the German Edition:
"Struts: Tutorial für Java-Entwickler"
© 2004 by Galileo Press
GALILEO COMPUTING is an imprint of Galileo Press,
Fort Lee, NJ (USA), Bonn (Germany).
German Edition first published 2004 by Galileo Press.


Stephan Wiesner
Technical Editor
Richard Deeson
Dinesh Kandalgaonkar
Cover Designer
Helen Wood
Suranga Ketkar
Chris Smith
Nanda Padmanabhan


It’s a long journey via instructions, Short and effective via examples.
This book offers step-by-step instructions on the Jakarta Struts Framework as well as on building a web application based on this Open Source software. As the book progresses, we will develop a web shop: the classic book store. This web application will help us to integrate the individual components of Struts into a complete and extensive package.
The crucial point lies in the practical application and not so much in the theoretical background. This book will first demonstrate the process of developing an application accompanied by short explanations. You can then experiment with the given code.

Struts is Simple

Struts, just like Java, is fundamentally simple. Any technology becomes simple when you understand it well. You must properly solve a problem in order to thoroughly understand it. Then you examine your old code, change it a little bit, apply few classes and you’ll be glad how fast you make progress. It’s difficult only the first time—something that holds true for most things even outside computer world.
Time and again we encounter the following obstacles:
  • The same problem rarely occurs twice.
  • One must learn constantly.
  • New things are usually poorly documented.
All these reasons lead to frustration and prejudices people against trying out new things.
This book offers an entry point into Struts; it cannot possibly cover everything. To make learning this new technology easier, this book consists of numerous examples and code. It follows the "Learning by doing" philosophy and I sincerely hope that you will find it useful and engaging.

What You Should Know Beforehand

The intended audience for this book is students with some computer science knowledge and interested Java developers who want to develop a small web project. The goal is to impart as much practice-oriented knowledge as possible. This tutorial is not aimed for theoretical training and does not claim to be a complete reference book.
The book expects a certain basic familiarity with Java, JSP and servlets (uncommon elements will, of course, be explained). JSPs and servlets are Java classes and it does not make sense to try to understand them without the required knowledge as a foundation.
This book is for anyone who is looking for an entry-level book to start working with Struts. Therefore no previous knowledge of Struts is required.
It is assumed that you have a PC at your disposal and you are allowed to set up and operate a server on it. A connection to the Internet is not required. If you are using a PC at a university or office, please make sure you have the rights to install software and operate a server (eventually you’ll have to use other ports).

Operating System and Tools

Windows XP is the operating system used in this book. Users of different systems must revise path names to some extent but other than that, most key points are operating system independent.
However, Linux/UNIX users must forgive me if I don’t always differentiate strictly between upper and lower case!
The browsers used are MS Explorer version 6.x and Mozilla 1.4. The software has been developed with www.jedit.org and www.eclipse.org. I describe installation processes for any required software. All references to file paths use the defaults for these installations. If you want to use other paths, then you have to revise them accordingly.

Software Versions

The following software versions are used:


The code examples aim to promote understanding and help to better explain the facts. Complete code listings as well as code fragments are given. At some places, only completed versions of code are given in the book and intermediate steps have been omitted. Full code listings are available on the book’s web site.
The individual context (see Glossary) for Tomcat is called ShopX, where X is a sequential number. This means that you can follow the development of the application and override your older versions. There are hints in the text for applying new contexts.
The code should always be well commented. I haven’t included many comments in this book because the accompanied text has detailed documentation.
In many places, I purposely employ a less-than-ideal approach. Instead of giving a long explanation of why one solution works better than the other, I simply demonstrate it: You will come across sudden problems in the text later, which could have been avoided early on. In keeping with the saying, "A person learns through mistakes", one must rewrite the code. The main drawback of this approach is that you might consider this book as a reference book. But in my opinion, you will be in a position to solve the problems by referring to the API yourself after you are done with the book, plus you can always look up certain points in the index from time to time.
The language files (see Chapter 4, Internationalization and Custom Actions) become more comprehensive as the book progresses. Their content is explicitly explained only in the first lesson. Then you can copy the versions from the big Shop-version or let it grow bit by bit. When an entry fails, Struts displays corresponding error messages. Please make yourself familiar with these messages as early on as possible. The most frequently asked questions on the Struts mailing list are related to these error messages.
I have developed the majority of the code examples myself, while other developers have come up with the rest of the examples. In such cases, the original source will be named. In the first instan...

Table of contents

Citation styles for Learning Jakarta Struts 1.2How to cite Learning Jakarta Struts 1.2 for your reference list or bibliography: select your referencing style from the list below and hit 'copy' to generate a citation. If your style isn't in the list, you can start a free trial to access over 20 additional styles from the Perlego eReader.
APA 6 Citation
Wiesner, S. (2005). Learning Jakarta Struts 1.2 (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/388776/learning-jakarta-struts-12-pdf (Original work published 2005)
Chicago Citation
Wiesner, Stephan. (2005) 2005. Learning Jakarta Struts 1.2. 1st ed. Packt Publishing. https://www.perlego.com/book/388776/learning-jakarta-struts-12-pdf.
Harvard Citation
Wiesner, S. (2005) Learning Jakarta Struts 1.2. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/388776/learning-jakarta-struts-12-pdf (Accessed: 14 October 2022).
MLA 7 Citation
Wiesner, Stephan. Learning Jakarta Struts 1.2. 1st ed. Packt Publishing, 2005. Web. 14 Oct. 2022.