WIRTSCHAFTSUNIVERSITÄT WIEN BAKKALAUREATSARBEIT Titel der Bakkalaureatsarbeit: Apache Velocity Englischer Titel der Bakkalaureatsarbeit: Apache Velocity Verfasserin/Verfasser: Markus Auchmann Matrikel-Nr.: 0451493 Studienrichtung: J033 526 Bakkalaureat Wirtschaftsinformatik Kurs: 1526 Projektseminar Textsprache: Englisch Betreuerin/Betreuer: Ao. Univ. Prof. Dr. Rony G. Flatscher Ich versichere: dass ich die Bakkalaureatsarbeit selbstständig verfasst, andere als die angegebenen Quellen und Hilfsmittel nicht benutzt und mich auch sonst keiner unerlaubten Hilfe bedient habe. dass ich die Ausarbeitung zu dem obigen Thema bisher weder im In- noch im Ausland (einer Beurteilerin/ einem Beurteiler zur Begutachtung) in irgendeiner Form als Prüfungsarbeit vorgelegt habe. dass diese Arbeit mit der vom Betreuer beurteilten Arbeit übereinstimmt. Datum Unterschrift Apache Velocity Table of Contents 1 Introduction...................................................................................................1 1.1 About this paper .......................................................................................1 1.2 Terms and Definitions ..............................................................................1 1.2.1 Template Engine............................................................................1 1.2.2 Web Template Engine ...................................................................2 1.2.3 Model View Controller....................................................................3 2 Web Template Engines ................................................................................4 2.1 Motivation.................................................................................................4 2.2 Smarty – PHP...........................................................................................4 2.2.1 Features.........................................................................................5 2.2.2 Sample...........................................................................................6 2.2.3 Summary .......................................................................................7 2.3 Contemplate – ASP, PHP, Perl ................................................................7 2.3.1 Features.........................................................................................8 2.3.2 Sample...........................................................................................8 2.3.3 Summary .....................................................................................10 2.4 Cheetah – Python...................................................................................11 2.4.1 Features.......................................................................................11 2.4.2 Sample.........................................................................................12 2.4.3 Summary .....................................................................................12 2.5 Embperl – Perl........................................................................................13 2.5.1 Features.......................................................................................13 2.5.2 Sample.........................................................................................14 2.5.3 Summary .....................................................................................15 2.6 FreeMarker – Java .................................................................................16 2.6.1 Features.......................................................................................16 2.6.2 Sample.........................................................................................17 2.6.3 Summary .....................................................................................20 3 Apache Velocity..........................................................................................21 3.1 History ....................................................................................................21 3.2 Introduction.............................................................................................21 Apache Velocity 3.3 Features .................................................................................................21 3.4 How it works – Hello World!....................................................................22 3.4.1 Fundamentals ..............................................................................22 3.4.2 View.............................................................................................23 3.4.3 Context ........................................................................................24 3.4.4 Controller .....................................................................................25 3.4.5 Initialize Velocity and merge ........................................................25 3.4.6 Output..........................................................................................28 4 Velocity Template Language .....................................................................30 4.1 References.............................................................................................30 4.1.1 Variables......................................................................................30 4.1.2 Methods.......................................................................................31 4.1.3 Properties ....................................................................................33 4.1.4 Quiet notations.............................................................................34 4.2 Directives................................................................................................35 4.2.1 #set..............................................................................................35 4.2.2 #if.................................................................................................37 4.2.3 #else ............................................................................................39 4.2.4 #elseif ..........................................................................................39 4.2.5 #foreach.......................................................................................40 4.2.6 #include .......................................................................................41 4.2.7 #parse..........................................................................................42 4.2.8 #stop............................................................................................43 4.3 Velocimacros..........................................................................................43 5 Sample Applications ..................................................................................46 5.1 Parsing XML...........................................................................................46 5.1.1 Model...........................................................................................46 5.1.2 View.............................................................................................47 5.1.3 Controller .....................................................................................48 5.1.4 Output..........................................................................................49 5.2 Using the Bean Scripting Framework .....................................................50 5.2.1 Jacl – Tcl......................................................................................50 5.2.2 Rhino – JavaScript.......................................................................52 Apache Velocity 5.2.3 BSF4Rexx – ObjectRexx .............................................................54 5.3 Guestbook using Servlets.......................................................................58 5.3.1 Create a web application in Tomcat.............................................58 5.3.2 VelocityViewServlet .....................................................................59 5.3.3 Planning process .........................................................................60 5.3.4 Controller .....................................................................................61 5.3.5 Model...........................................................................................62 5.3.6 View.............................................................................................65 5.4 Powering Ajax Applications ....................................................................68 5.4.1 Fundamentals ..............................................................................68 5.4.2 Controller .....................................................................................68 5.4.3 Toolbox ........................................................................................69 5.4.4 View.............................................................................................69 5.4.5 The velocity.properties configuration file......................................70 5.4.6 Output..........................................................................................70 6 Summary .....................................................................................................71 7 List of references........................................................................................72 8 Appendix: ....................................................................................................75 8.1 Setting up Velocity..................................................................................75
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages83 Page
-
File Size-