Simple Blog Example
This example has two domain model objects - Blog and Post. You can choose your blog, then choose a post in that blog. It runs in three different modes: server only: scc example.simpleBlog.queryParam jetty.schtml client only: scc example.simpleBlog.queryParam js.schtml client/server: scc example.simpleBlog.queryParam jetty.schtml js.schtml

Here's the ViewBlog template page that shows the use of QueryParam annotations to bind page properties to query parameters in the URL:

file: example/simpleBlog/queryParam/ViewBlog.schtml
<%@ @URL(pattern="/blog/") %>
<html>
  <%!
      @QueryParam
      int blogId;
      @QueryParam(name="post")
      String postShortName;

      Blog blog := Blog.getBlog(blogId);
      Post post := blog == null ? null : blog.getPost(postShortName);
  %>
  <body>
      <span id="blogList" repeat=":= Blog.blogs" repeatVarName="curBlog">
         <a href='= pageBaseURL + "?blogId=" + curBlog.blogId' class=':= blog == curBlog ? "currentBlogLink" : "blogLink"'><%= curBlog.blogName %></a>
      </span>
      <div visible=":= blog != null" id="postList" repeat=":= blog.posts" repeatVarName="curPost">
         <a href='= pageBaseURL + "?blogId=" + blog.blogId + "&post=" + curPost.shortName' class=':= post == curPost ? "currentPostLink" : "postLink"'><%= curPost.title %></a>
      </div>
      <div id="blogDesc" visible=":= blog != null">
         <%= blog.blogDesc %>
      </div>
      <div id="blogSelect" visible=":= blog == null">
         Please select a blog.
      </div>
      <div id="postContent" visible=":= post != null">
         <h3><%= post.title %></h3>
         <%= post.postText %>
      </div>
      <div id="blogSelect" visible=":= post == null">
         Please select a post.
      </div>
  </body>
</html>

The same thing using URL based parameters:

file: example/simpleBlog/urlParam/ViewBlog.schtml
<%@ @URL(pattern="/blog/[{blogId=integerLiteral}/][{postShortName=identifier}/]") %>
<html>
  <%!
      int blogId;
      String postShortName;

      Blog blog := Blog.getBlog(blogId);
      Post post := blog == null ? null : blog.getPost(postShortName);
  %>
  <body>
      <span id="blogList" repeat=":= Blog.blogs" repeatVarName="curBlog">
         <a href='= "/blog/" + curBlog.blogId + "/"' class=':= blog == curBlog ? "currentBlogLink" : "blogLink"'><%= curBlog.blogName %></a>
      </span>
      <div visible=":= blog != null" id="postList" repeat=":= blog.posts" repeatVarName="curPost">
         <a href='= "/blog/" + blog.blogId + "/" + curPost.shortName + "/"' class=':= post == curPost ? "currentPostLink" : "postLink"'><%= curPost.title %></a>
      </div>
      <div id="blogDesc" visible=":= blog != null">
         <%= blog.blogDesc %>
         <div id="alt">
            Please select a blog.
         </div>
      </div>
      <div id="postContent" visible=":= post != null">
         <h3><%= post.title %></h3>
         <%= post.postText %>
         <div id="alt">
            Please select a post.
         </div>
      </div>
  </body>
</html>