Download presentation
Presentation is loading. Please wait.
Published byPreston Reed Modified over 9 years ago
1
© MIT 2000 Building Web Applications With Webjects Michael D. Barker The MIT Educational Media Creation Center November 2001
2
© MIT 2001 Key Parts of This Presentation n What's a Webject? n Graphic Views of the Servlets n Configuration Files n Parameters
3
© MIT 2001 What's a Webject? n Webject as one set of data (and a webjectlist as a collection of webjects!) n A set of servlets, allowing handling of several "standard" operations on data over the web by setting up the correct forms and configuration files. Notice that I did not say writing code – the servlets are deliberately designed to be generic, so that changes are made in the forms and configuration files, not the code. n At this point in time, there are six webject servlets: Capture, Lister, Displayer, Revise, Deleter, and Publisher.
4
© MIT 2001 Key Parts of This Presentation n What's a Webject? n Graphic Views of the Servlets n Configuration Files n Parameters
5
© MIT 2001 Capture HTML Form Capture Servlet Webject List Capture is used to collect information from a web form for ONE webject. Often, the web form is just a simple html page, with form action posting to capture.
6
© MIT 2001 Lister HTML Form Lister Servlet Webject List Lister generates a web form displaying information from all the webjects in a list. HTMX Template
7
© MIT 2001 Displayer HTML Form Displayer Servlet Webject List Displayer generates a web form displaying information from a single webject. HTMX Template
8
© MIT 2001 Revise HTML Form Revise Servlet Webject List Revise is used to collect information from a web form to make changes for ONE webject. Almost always the web form is generated by displayer.
9
© MIT 2001 Deleter HTML Form Deleter Servlet Webject List Deleter is used to remove one webject from the list. Often, it is invoked from a form generated by lister, although it is often useful to use displayer to generate a form showing the details of the webject being deleted to confirm that the correct object has been selected. (There is no undelete!)
10
© MIT 2001 Publisher HTML File Publisher Servlet Webject List Publisher generates a file containing a web form displaying information from all the webjects in a list. HTMX Template
11
© MIT 2001 Typical Application (with apologies for torturing English) n Collect information (using Capture) n Display a list of results (using Lister) n With edit buttons (using Displayer) that bring up forms whose submit changes the information (using Revise) n And delete buttons (that bring up a form to confirm, then invoke Deleter)
12
© MIT 2001 Key Parts of This Presentation n What's a Webject? n Graphic Views of the Servlets n Configuration Files n Parameters
13
© MIT 2001 Parameters, XML files, and such n Every servlet has some parameters. n webject specification file n webject list file n Configuration in servlet zone properties file (this will change with Tomcat!) n page templates (htmx templates)
14
© MIT 2001 Webject Specification File <parameter name="term" required="1" errorRequired="You must provide a term to be defined." /> <parameter name="definition" required="1" errorRequired="You must provide a definition for the term." /> Replace the parameter definitions with your data fields.
15
© MIT 2001 Possible Attributes Among the attributes that can be specified for a parameter are: n name="name" The name of the parameter. Required. n required="1" n errorRequired="message" n optional="1" (default) n ignored="1" (discard even if value present – good for discarding submit) n multiple="1" May have multiple values n default="value" n equals="name" use value of name n defaultequals="name" use value of name as default n format="type" where type is one of name, extphone, phone, email, state, zipcode, password
16
© MIT 2001 Webject List File <iplist type="iprange" specfile="../conf/iplistspec.xml" docclass="edu.mit.emcc.webject.WebjectList" webjectclass="edu.mit.emcc.webject.Webject"> 1
17
© MIT 2001 Webject List With Files File <iplist type="iprange" specfile="../conf/iplistspec.xml" docclass="edu.mit.emcc.webject.WebjectList" webjectclass="edu.mit.emcc.webject.Webject" filestoredir="directory" (relative to the webject file itself) filedirmaxsize="bytecount" fileurlprefix="url/prefix" > 1
18
© MIT 2001 HTMX Templates n Normal HTML plus (Displayer and Lister) n : the value of name n : CHECKED if non-blank value n : SELECTED if value n : value escaped for use in html form (e.g. " becomes ") (Lister only) n : number of items in list n... : repeat for all elements in list
19
© MIT 2001 HTMX Templates n content- type of file n URL for the file n last update time
20
© MIT 2001 Key Parts of This Presentation n What's a Webject? n Graphic Views of the Servlets n Configuration Files n Parameters
21
© MIT 2001 Capture Parameters Minimum: n servlet.AddTicket.code=edu.mit.emcc.webject.Capture (alias) n servlet.AddTicket.initArgs=root=/development (root directory to prepend to all other file names) n servlet.AddTicket.initArgs=capturepage=ListTickets or servlet.Register.initArgs=capturepage=../lobby/register. html (html form, allows gets to servlet to redirect to form) n servlet.AddTicket.initArgs=webjectlist=data/ccoach/ac cessinfo/tickets.xml (the webject list)
22
© MIT 2001 Capture Parameters Additional: n servlet. SomeName.initArgs=templatedir= Directory where HTML templates are stored n servlet. SomeName.initArgs=successtemplate= for successful submissions (default: capturesuccess.htmx) n servlet. SomeName.initArgs=errortemplate= for validation errors (captureerror.htmx) n servlet.SomeName.initArgs=duplicatetemplate= for duplicate keys (captureduplicate.htmx) n There is also a set of parameters to generate email – read the code for details (list follows)
23
© MIT 2001 Capture Parameters (email) n servlet.SomeName.initArgs=mailserver=(address) n servlet.SomeName.initArgs=partialemailtemplate=(filename) n servlet.SomeName.initArgs=partialto=(address) n servlet.SomeName.initArgs=partialsubject=(subject) n servlet.SomeName.initArgs=partialfrom=(address) n servlet.SomeName.initArgs=completeemailtemplate=(filename) n servlet.SomeName.initArgs=completeto=(address) n servlet.SomeName.initArgs=completesubject=(subject) n servlet.SomeName.initArgs=completefrom=(address)
24
© MIT 2001 Capture Parameters (file upload) n servlet.SomeName.initArgs=filetempdir=(directory) n servlet.SomeName.initArgs=filemaxpostsize=(int) Note: must be coordinated with change in webject list file (see Webject List with Files)
25
© MIT 2001 Lister Parameters Minimal n servlet.SomeName.code=edu.mit.emcc.webject.Lister (alias) n servlet. SomeName.initArgs=projectroot= (root of files) n servlet. SomeName.initArgs=webjectlist= (data list) n servlet. SomeName.initArgs=templatedir= (where are the templates)
26
© MIT 2001 Lister Parameters Optional n servlet. SomeName.initArgs=listtemplate= Defaults to listtemplate.htmx n servlet. SomeName.initArgs=mimetype= Defaults to text/html n servlet. SomeName.initArgs=sortby= n servlet. SomeName.initArgs=sortmethod= Defaults to text n servlet. SomeName.initArgs=daysback= How many days back to include (defaults to all) Often entered in url (servlet name?daysback=5 for example)
27
© MIT 2001 Lister Request Parameters n daysback=n n sortby=fieldname n sortmethod=text|date n selectby=fieldname n selectvalue=value
28
© MIT 2001 Publisher Parameters n All the Lister parameters plus: n servlet.Publisher.initArgs=success=[filename] (relative to templatedir) n servlet.Publisher.initArgs=failure=[filename] (relative to templatedir) n servlet.Publisher.initArgs=outfile=[filename] (relative to projectroot)
29
© MIT 2001 Displayer Parameters Minimal n servlet.SomeName.code=edu.mit.emcc.webject.Displayer (alias) n servlet.SomeName.initArgs=projectroot= (root for files) n servlet.SomeName.initArgs=webjectlist= (data list) n servlet.SomeName.initArgs=templatedir=
30
© MIT 2001 Displayer Parameters Optional n servlet.SomeName.initArgs=webjecttemplate= Defaults to webjecttemplate.htmx n servlet.SomeName.initArgs=notfoundtemplate= Defaults to notfoundtemplate.htmx n servlet.SomeName.initArgs=idsource= How to get id of webject. Defaults to parameter (ID=xxx). Also accepts auth (look up user in webject list) and username (a username parameter will be supplied)
31
© MIT 2001 Revise Parameters Minimal n servlet.SomeName.code=edu.mit.emcc.webject.Revise (alias) n servlet.SomeName.initArgs=projectroot= n servlet.SomeName.initArgs=editpage= n servlet.SomeName.initArgs=webjectlist= n servlet.SomeName.initArgs=templatedir=
32
© MIT 2001 Revise Parameters Optional n servlet.SomeName.initArgs=successtemplate= Defaults to revisesucess.htmx n servlet.SomeName.initArgs=errortemplate= Defaults to reviseerror.htmx
33
© MIT 2001 Deleter Parameters Minimal n servlet.SomeName.code=edu.mit.emcc.webject.Deleter (alias) n servlet.SomeName.initArgs=projectroot= n servlet.SomeName.initArgs=webjectlist= n servlet.SomeName.initArgs=templatedir= Runtime n SomeName?ID=xxxxx Or SomeName?id=xxxxxx
34
© MIT 2001 Deleter Parameters Optional n servlet.SomeName.initArgs=deletedtemplate= Defaults to deletedtemplate.htmx
35
© MIT 2001 Likely Future Additions to the Webject Library n "archive" – put a class of webjects into another file and remove from the "active" file n Conversion to use mySQL, Oracle, or other database n Multi-valued field display n Faster lister n Basic webject build tool
36
© MIT 2001 For Additional Information n Brian Bermack's original documentation
37
© MIT 2001 You Can Reach Us... n Michael Barker –mbarker@mit.edu –617/253-0119 n EMCC website: http://web.mit.edu/emcc/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.