+ All Categories

WWiA

Date post: 02-Jun-2018
Category:
Upload: shaharukh-nadaf
View: 221 times
Download: 0 times
Share this document with a friend

of 26

Transcript
  • 8/10/2019 WWiA

    1/26

    WebWork in Action

    An introduction to WebWorkPatrick A. Lightbody

  • 8/10/2019 WWiA

    2/26

    Introduction

    WebWork: an OpenSymphony project What is WebWork?

    What is OpenSymphony? Who is Patrick? omparison to other !eb "rame!orks

    Struts #apestry

    $S%

  • 8/10/2019 WWiA

    3/26

    e&ook no!a'ai(ab(e

    Print 'ersionready )any dayno!*

    Ask +uestions, get a "reecopy-

  • 8/10/2019 WWiA

    4/26

    )Wo!* eamp(e

    /etting started has ne'er been easier

    0emonstration o": In'ersion o" ontro( #emp(ate (ibrary

    #ype con'ersion

    1a(idation

  • 8/10/2019 WWiA

    5/26

  • 8/10/2019 WWiA

    6/26

    O'er'ie!: WebWork2

    Is bui(t upon the ommand Pattern

    Works !ith PO$Os

    3ses O/4L "or epression (anguage and typecon'ersion

    5as an ad'anced 'a(idation "rame!ork

    Inc(udes an etensib(e !idget system

    Supports many 'ie! techno(ogies: $SP6%ree7arker6 1e(ocity6 $asper8eports6 9SL#6 etc

  • 8/10/2019 WWiA

    7/26

    ore concepts

    #hree key pieces:Actions PO$Os6 ActionSupport;

    8esu(ts

    Interceptors

    4o )"orm beans*: the action is the mode(

    1a(ue stack a((o!s (oose coup(ing Interceptors: )AOP (ite*

  • 8/10/2019 WWiA

    8/26

  • 8/10/2019 WWiA

    9/26

    /etting started

    #!o options: Standard ser'(et

  • 8/10/2019 WWiA

    10/26

    Ser'(et container

    >'erything starts !ith the %i(ter0ispatcher

    #he %i(ter0ispatcher is responsib(e "or: >ecuting actions Ser'ing static content A$A9,re(ated "i(es;

    #he in'ersion o" contro( )re+uest* scope

    (eaning up the Actionontet #hreadLoca(;

  • 8/10/2019 WWiA

    11/26

    !eb.m(

    "i(ter@

    "i(ter,name@!eb!ork"i(ter,name@

    "i(ter,c(ass@2.%i(ter0ispatcher"i(ter,c(ass@

    "i(ter@"i(ter,mapping@

    "i(ter,name@!eb!ork"i(ter,name@

    ur(,pattern@Bur(,pattern@

    "i(ter,mapping@

    (istener@

    (istener,c([email protected]"ecyc(eListener(istener,c(ass@

    (istener@

  • 8/10/2019 WWiA

    12/26

    )Prototype*

    Is the +uickest !ay to get started Is inspired by App%use6 8uby on 8ai(s

    Is po!ered by a bui(t,in $etty ser'er Automatica((y compi(es your source "i(es /ets your started in three steps:

    3nCip !eb!ork,

  • 8/10/2019 WWiA

    13/26

    !ork.m(

    on"iguration "or actions6 resu(ts6 andinterceptors

    Support "or packages and packageinheritence

    Optiona( mapping to namespaces

    Additiona( "i(es can be inc(uded usinginc(ude@

  • 8/10/2019 WWiA

    14/26

    !ork.m( >amp(e

    !ork@

    inc(ude "i(eDE!eb!ork,de"au(t.m(E@

    package nameDEde"au(t*

    etendsDE!eb!ork,de"au(tE@ action nameDE(istPeop(eE c(assDEListPeop(eE@

    resu(t@(istPeop(e."t(resu(t@

    action@

    package@

    !ork@

  • 8/10/2019 WWiA

    15/26

    1a(ue stack

    A(( epressions !ork against the 'a(uestack

    Actions are pushed on the stack be"oreanything e(se happens

    Additiona( objects6 such as those in an

    interator or action chaining6 can be pusheddo!n

  • 8/10/2019 WWiA

    16/26

  • 8/10/2019 WWiA

    17/26

    #ype con'ersion

    5##P is not a!are o" data types2 2 but $a'a is-

    WebWork he(ps by (etting you !ork !ith yourra! PO$Os rather than type(ess intermediate

    objects "orm beans;.

    5e(ps !ith simp(e con'ersion primiti'es;as !e(( as comp(e PO$Os andco((ections;

  • 8/10/2019 WWiA

    18/26

    #ype con'ersion eamp(es

    String ,@ int input nameD)id*@

    StringFG ,@ ListString@ input nameD)name*@

    omp(e types

    input nameD)person.id*@ input nameD)peop(eFHG.id*@

    input nameD)person."riends.name*@

  • 8/10/2019 WWiA

    19/26

    1a(idation

    Abstracts 'a(idation ru(es "rom core code

    ommon ru(es a'ai(ab(e re+uired6 rege6

    date range6 etc; Sames ru(es !ork !ith c(ient,side

    'a(idation using A$A9 ,, see my other

    presentation "or more in"o;

  • 8/10/2019 WWiA

    20/26

    #emp(ate (ibrary

    P(at"orm to create reusab(e 3I !idgets

    %orm contro(s pro'ided out o" the bo

    /roups o" temp(ates "orm )themes* #he )htm(* theme is simp(e t!o,co(umn

    (ayout

    #hemes can etend each other aja ,@ htm( ,@ simp(e

  • 8/10/2019 WWiA

    21/26

    The xhtml theme extends the

    simple theme and provides a

    standard two-columnlayout

  • 8/10/2019 WWiA

    22/26

    3ses o" interceptors

    Pro'ide 'ery core "eatures "or WebWork: Logging

    App(ying 5##P re+uest parameters

    In'oking Io

    In'oking the 'a(idation "rame!ork

    A(so pro'ide ad'anced "unctiona(ity2

  • 8/10/2019 WWiA

    23/26

  • 8/10/2019 WWiA

    24/26

    0emo2

  • 8/10/2019 WWiA

    25/26

    Wrapping up

    Prototype is a great !ay to get started 3ti(iCe the temp(ates create your o!n

    themes #ype con'ersion bridges the gap bet!een

    5##P and $a'a

    3se the 'a(idation "rame!ork especia((y!ith A$A9; 3ti(iCe interceptors !hen appropriate

  • 8/10/2019 WWiA

    26/26

    Juestions?