[jboss-user] [JBoss Seam] - Re: <s:cache> and nested repeat elements

alexg79 do-not-reply at jboss.com
Sat Jul 7 13:13:16 EDT 2007


I'm using JBoss 4.2.0GA and therefore JSF 1.2, with Seam 2.0.0beta1. Perhaps this is a Facelets issue?
Here's the xhtml snippet:

  | 			<s:cache key="mainPage" region="/pageFragments">
  | 				<tr class="headercell">
  | 					<td class="category">Category</td>
  | 					<td class="files">Files</td>
  | 					<td class="lastentry">Last Entry</td>
  | 				</tr>
  | 	 			<c:forEach items="#{categories}" var="root">
  | 					<tr class="bodycellheader">
  | 						<td class="category">
  | 						<div class="arrow">»</div>
  | 						<div class="catname">
  | 							<s:link view="/category.xhtml" value="#{root.name}">
  | 								<f:param name="categoryId" value="#{root.id}"/>
  | 							</s:link>
  | 						</div>
  | 						</td>
  | 						<td class="files">#{root.numEntries}</td>
  | 						<td class="lastentry">
  | 							<s:link view="/entry.xhtml" value="#{root.lastEntry.title}">
  | 								<f:param name="entryId" value="#{root.lastEntry.id}"/>
  | 							</s:link>
  | 						</td>
  | 					</tr>
  | 					<c:forEach items="#{root.subcategories}" var="cat">
  | 						<tr class="bodycellsubheader">
  | 							<td style="padding-left: 2.4em;" class="category">
  | 								<s:link view="/cat.xhtml" value="#{cat.name}">
  | 									<f:param name="categoryId" value="#{cat.id}"/>
  | 								</s:link><br />
  | 							<div class="catdesc">#{cat.description}</div>
  | 							</td>
  | 							<td class="files">#{cat.numEntries}</td>
  | 							<td class="lastentry">
  | 								<s:link view="/entry.xhtml" value="#{cat.lastEntry.title}">
  | 									<f:param name="categoryId" value="#{cat.lastEntry.id}"/>
  | 								</s:link>
  | 							</td>
  | 						</tr>
  | 					</c:forEach>
  | 				</c:forEach>
  | 				<tr class="bodycellheader">
  | 					<td class="category">
  | 					<div class="arrow">»</div>
  | 					<div class="catname"><s:link view="/viewall.xhtml">View
  | 					All Files</s:link><br />
  | 					View all of the files in the database</div>
  | 					</td>
  | 					<td class="files">#{home.totalEntryCount}</td>
  | 					<td class="lastentry">
  | 						<s:link view="/entry.xhtml" value="#{home.lastEntryTitle}">
  | 							<f:param name="entryId" value="#{home.lastEntryId}"/>
  | 						</s:link>
  | 					</td>
  | 				</tr>
  | 			</s:cache>
  | 
and the backing bean:

  | @Scope(ScopeType.EVENT)
  | @Name("home")
  | @Stateful
  | public class HomeBean implements HomeLocal {
  | 
  | 	@PersistenceContext(type = PersistenceContextType.EXTENDED)
  | 	private EntityManager em;
  | 
  | 	private int totalEntryCount;
  | 	private Long lastEntryId;
  | 	private String lastEntryTitle;
  | 
  | 	@SuppressWarnings("unchecked")
  | 	@Factory("categories")
  | 	public List<Category> initCategories() {
  | 		List<Category> categories = em.createNamedQuery(Category.QUERY_ROOTCATEGORIES).getResultList();
  | 		for (Category cat : categories) {
  | 			totalEntryCount += cat.getEntries().size();
  | 			Entry lastEntry = cat.getEntries().get(0);
  | 			if (lastEntry != null && (lastEntryId == null || lastEntry.getId() > lastEntryId)) {
  | 				lastEntryId = lastEntry.getId();
  | 				lastEntryTitle = lastEntry.getTitle();
  | 			}
  | 		}
  | 		return categories;
  | 	}
  | 
  | 	public int getTotalEntryCount() {
  | 		return totalEntryCount;
  | 	}
  | 
  | 	public Long getLastEntryId() {
  | 		return lastEntryId;
  | 	}
  | 
  | 	public String getLastEntryTitle() {
  | 		return lastEntryTitle;
  | 	}
  | 
  | 	@Remove @Destroy
  | 	public void destroy() {}
  | 
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061619#4061619

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061619




More information about the jboss-user mailing list