You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Glenn Nielsen <gl...@earthdome.org> on 2005/12/31 15:39:17 UTC

Simple JavaBean for use in JSP main blog page

Struts works very well for transactional applications but can be
overly complex for a blog site main page. I found it was much simpler
to use a simple JavaBean which had methods for obtaining recent
blog entries, hot blog entries, etc. within a JSP page which uses
the Standard Taglib.

Please consider providing a default main page with roller which
uses this simpler technology. This will make it easer for those
who install Roller to customize the look of their roller website.

Attached is the JavaBean I wrote.

Here is some example JSP code which sets up to use roller blog
entries from the bean.

<%@ page session="false" language="java" errorPage="/error.jsp" contentType="text/html; charset=UTF-8" %><%@
taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@
taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %><%@
taglib uri="http://www.rollerweblogger.org/tags" prefix="roller" %>

<fmt:setBundle basename="ApplicationResources" />
<jsp:useBean id="blog" scope="request" class="org.lpmo.roller.BlogBean">
 <jsp:setProperty name="blog" property="maxRecentEntries" value="12"/>
 <jsp:setProperty name="blog" property="maxPopularWebsites" value="12"/>
</jsp:useBean>
<c:set var="recent" value="${blog.recentEntries}"/>
<c:set var="popularWebsites" value="${blog.popularWebsites}"/>

Thanks,

Glenn