Package org.expressme.webwind.renderer

Examples of org.expressme.webwind.renderer.TemplateRenderer


    }

    @Mapping("/")
    public Renderer index() throws Exception {
        List<Post> posts = DbUtils.queryForList("select id, title, content, creation from Post order by id desc");
        return new TemplateRenderer("/index.htm", "posts", posts);
    }
View Full Code Here


    @Mapping("/blog/display/$1")
    public Renderer display(long id) throws Exception {
        List<Post> posts = DbUtils.queryForList("select id, title, content, creation from Post where id=?", id);
        if (posts.isEmpty())
            throw new IllegalArgumentException("Post not found with id: " + id);
        return new TemplateRenderer("/display.htm", "post", posts.get(0));
    }
View Full Code Here

     * Show create page.
     */
    @Mapping("/blog/create")
    public Renderer create() {
        Post post = new Post((-1), "", "");
        return new TemplateRenderer("/edit.htm", "post", post);
    }
View Full Code Here

    @Mapping("/blog/update/$1")
    public Renderer update(long id) throws Exception {
        List<Post> posts = DbUtils.queryForList("select id, title, content, creation from Post where id=?", id);
        if (posts.isEmpty())
            throw new IllegalArgumentException("Post not found with id: " + id);
        return new TemplateRenderer("/edit.htm", "post", posts.get(0));
    }
View Full Code Here

TOP

Related Classes of org.expressme.webwind.renderer.TemplateRenderer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.