Full code for MyFirstWebApplication, mark4.

    application org.webdsl.myfirstwebapp.mark4

    description {
      A community site about research.
    }

    section data model

      entity Publication {
        title     :: String (name)
        authors   -> List<Person> (inverse=Person.publications)
        abstract  :: Text
        published :: Date
        url       :: URL
      }

      entity Person {
        fullname     :: String (name)
        homepage     :: URL   (optional)
        email        :: Email (optional)
        address      <> Address 
        publications -> Set<Publication> 
      }

      entity Address {
        street  :: String
        city    :: String
        country :: String
        phone   :: String
      }

    section home page

      define page home() {
        main()
        define body() {
          section{
            header{"Publications"}
            list{
              for(pub : Publication) {
                listitem{ 
                  navigate(publication(pub)){text(pub.name)}
                }
              }
              listitem{navigate(createPublication()){"New Publication"}}
            }
          }
          section{
            header{"Authors"}
            list{
              for(pers: Person) {
                listitem{ output(pers) }
              }
              listitem{navigate(createPerson()){"New Person"}}
            }
          }
        }
      }

      define page publication(p : Publication) {
        main()
        define body() {
          section{
            header{output(p)}
            par{
              "by " 
              for(a : Person in p.authors) {
                output(a) " "
              }
              "at " output(p.published)}
            section{
              header{"Abstract"}
              output(p.abstract)
            }
            "Published: " output(p.url)
          }
          reviews(p)
        }
        define manageMenu() {
          navigate(editPublication(p)){"Edit"}
        }
      }

    section templates 

      define main() {
        block("top") {
          top() }
        block("body") {
          block("left_innerbody") {
            sidebar() }
          block("main_innerbody") {
            body() } }
        block("footer") {
          footer() 
        } 
      }

      define top() {
        block("header") {}
        block("menubar") { 
          applicationMenubar() } }

      define body() {}
      define manageMenu() {}
      define footer() {}
      define sidebar() { 
        navigate(home()){"Home"}
      }

      define applicationMenubar()
      {
        menubar {
          menu { 
            menuheader{ "People" }
            for(p : Person) {
              menuitem{ output(p) }
            }
          }
          menu {
            menuheader{ manageMenu() }
          }
        }
      }

    section reviews

      entity Review {
        publication -> Publication (inverse=Publication.reviews)
        author      -> Person
        content     :: WikiText
        created     :: Date
      }

      extend entity Publication {
        reviews -> Set<Review> 
      }

      define reviews(p : Publication) {
        showReviews(p)
        var text   : WikiText;
        var person : Person;
        section{ 
          header{"Write a Review"}
          form {
            input(text)
            par{input(person)}
            action("Submit", submitReview())
            action submitReview() {
              var review : Review := 
                Review {
                  content := text
                  author  := person
                  publication := p
                };
              p.reviews.add(review);
              p.persist();
              return publication(p);
            }
          }
        }
      }

      define showReviews(p : Publication) {
        for(r : Review in p.reviewsList) {
          section {
            header{"Review by " output(r.author)} 
            par{" at " output(r.created)}
            output(r.content)
          }
        }
      }

Contributions by EelcoVisser