Java_Struts_Tutorial.pdf
(
1239 KB
)
Pobierz
44687217 UNPDF
Struts Tutorial
by Stephan Wiesner
Struts Tutorial
by Stephan Wiesner
Copyright © 2002 Stephan Wiesner
This is a tutorial for the Struts framework. It consists of a small application which is developed
step by step. It can display books in the browser, new books can be created and their state
saved/loaded in xml files. I try to do the whole thing step by step, with lots of screenshots to
show that it really does work and to help you along. Many of the screenhots actually show error
messages. This will help you avoid some of the many pitfalls along the way. This work should
enable you to work with Struts in a short time, but you will not become a Struts guru with it.
You should have the official documentation at hand to read the theoretical background. This
work is
closed
, I don't think I will continue it's development.
Struts Tutorial
Table of Contents
1.Introduction.
...........................................................................................................................1
1.1.Introduction .
................................................................................................................1
2. Installation of Struts ..
.............................................................................................................. 2
3. The First Try: Simple JSP ..
...................................................................................................... 3
4. Second Try: Struts For Internationalisation ..
............................................................................. 4
5. Struts for Forms ..
.................................................................................................................... 9
5.1. First Try at Forms ..
...................................................................................................... 9
5.2. Struts: Introducing the ActionForm ..
............................................................................. 14
5.3. A better way to seperate Book and BookForm ...
............................................................. 17
5.4. Handling Invalid Entries ..
............................................................................................. 18
5.5. Recapitualation: Where we are ..
.................................................................................... 21
6.UsingLogic ..
.......................................................................................................................... 23
6.1. First Try at Logic ..
....................................................................................................... 23
6.2.AdvancedLogic .
.......................................................................................................... 24
7.Templates.
..............................................................................................................................30
8. Beans to XML .
....................................................................................................................... 33
9. Replacing JSP with XSLT ..
..................................................................................................... 37
10.IntroducingAspectJ .
............................................................................................................. 39
11. Ant for Compilation and Distribution ..
................................................................................... 42
11.1. Installation of ANT .
................................................................................................... 42
11.2. What is ANT ..
............................................................................................................ 42
11.3. Configuration of ANT .
............................................................................................... 42
11.4. Usage of ANT ..
.......................................................................................................... 43
12.Conclusions .
.........................................................................................................................46
13. Large Scale Example ..
........................................................................................................... 47
14.FAQ.
....................................................................................................................................48
15.Epilogue .
..............................................................................................................................50
15.1. Technical Background of this Document ..
.................................................................... 50
15.2. About the Author .
...................................................................................................... 50
16.UserComments .
................................................................................................................... 52
16.1.Mails .
........................................................................................................................52
16.2.PostCards..
................................................................................................................ 53
A.Glossary .
...............................................................................................................................57
B. Solutions to Exercises ..
........................................................................................................... 58
B.1.CDs .
...........................................................................................................................58
B.2.MixedSolutions .
......................................................................................................... 60
C.Bibliography .
.........................................................................................................................61
iv
Struts Tutorial
List of Figures
2.1. The folder structure ..
............................................................................................................ 2
3.1. Our First Page ..
.................................................................................................................... 3
4.1. Needed LTD files ..
............................................................................................................... 4
4.2. Displaying the German title element ..
.................................................................................... 6
4.3. Reloading a Context With Tomcat 4.x ..
................................................................................. 7
5.1. Nice Errormessages are always close at hand ..
....................................................................... 11
5.2. Using Struts.jar locally .
........................................................................................................ 13
5.3. Where is the book? ..
............................................................................................................. 13
5.4. . . . here is one. ..
................................................................................................................... 14
5.5. Book Creation and Validation ..
............................................................................................. 16
5.6. Our first Error Message ..
...................................................................................................... 20
5.7. Correct Error Messages .
....................................................................................................... 21
6.1. Iterate, using for-loop .
.......................................................................................................... 23
6.2. Our First Template displayed ..
.............................................................................................. 29
7.1. Our First Template displayed ..
.............................................................................................. 32
8.1. Error Serializing a Bean ..
...................................................................................................... 34
9.1. Display the Book as XML .
................................................................................................... 38
10.1. Logging with AspectJ ..
....................................................................................................... 40
10.2. AspecjtJ Times your Methods. ..
.......................................................................................... 41
11.1. ANT doesn't know Struts ..
.................................................................................................. 43
11.2. Voila, application running from WAR ..
............................................................................... 45
15.1.StephanWiesner .
............................................................................................................... 51
16.1. One World, one Tutorial :-) ..
............................................................................................... 53
16.2. Balog from Budapest ..
........................................................................................................ 54
16.3. Luca from Paris ..
................................................................................................................ 55
16.4. Sumeer from Singapore .
..................................................................................................... 56
B.1. Sorted List of Books ..
.......................................................................................................... 60
v
Plik z chomika:
gienek74
Inne pliki z tego folderu:
Java_Struts_Tutorial.pdf
(1239 KB)
JavaScriptCwiczeniapraktyczne.rar
(1543 KB)
Dariusz Dorozinski - Hakerzy Technoanarchisci Cyberprzestrzeni.rar
(4609 KB)
Arkadiusz Jakubowski - Podstawy SQL.rar
(5564 KB)
Linux - Księga eksperta.zip
(3416 KB)
Inne foldery tego chomika:
Kuchnia
rozne
Zgłoś jeśli
naruszono regulamin