📄 index.jsp
字号:
<%/** * $RCSfile: index.jsp,v $ * $Revision: 1.4 $ * $Date: 2002/09/30 19:09:54 $ */%><%@ page import="java.util.*, com.jivesoftware.util.*, com.jivesoftware.forum.*, com.jivesoftware.forum.util.*, com.jivesoftware.base.*" errorPage="error.jsp"%><% // Page Description: // // This page is usually the main entry point to your community so on this // page we'll simply show the list of categories and forums in those // categories. For each forum that is displayed we'll show the the number // of topics and messages in it, the link to its page and the date the // last message was posted. // // Also on this page will be a few boxes which add extra functionality to // our forum application: // * A search box will be displayed as a way to quickly run a search of // the forum content. // * A box containing the most active dicussions over all of the forums // is displayed. This will highlight the most active parts ot our // community. // * Finally, we will show the login/logout links as well as a link to the // logged-in user's profile. This is a special set of links because they // will be included on every page in the forum. // // A note on how the categories are dislayed: The default Jive Forums skins // features more advanced layout logic for categories. To keep things // simple this skin will only display the forums in the root category (if // any exist) and the categories directly below the root category (again, // if any exist). An example illustrates how this is done: // // Say you have 2 forums in the root category and 2 subcategories, each // with one forum each. The category/forum tree would look like: // // Root Category // |- Forum A // |- Forum B // |- Category 01 // | |- Forum C // |- Category 02 // |- Forum D // // In this skin, that tree will render on the page as: // // [ Category/Forum Name | Topics/Messages | Last Message ] // -------------------------------------------------------------------- // Forum A | 23 / 45 | Sep 9 2002, 1:35pm // Forum B | 19 / 32 | Sep 9 2002, 9:17pm // Category 01 // Forum C | 45 / 101 | Sep 9 2002, 9:51pm // Category 02 // Forum D | 19 / 55 | Sep 7 2002, 3:30am // // Sub-categories below Category 01 or Category 02 will be ignored. In the // default skin the names of the categories would actually appear as links // which would allow the user to drill-down in the category heirarchy. // For simplicity, this skin will just assume one level of categories.%><% // global.jsp is a collection of utility methods and global variables. // Page authorization and the creation of the authToken and forumFactory // variables are handled there. // Because global.jsp is included statically (as opposed to a dynamic // include), all variables declared in it can be called as local variables // in this page (you'll see below when the "forumFactory" variable is // referenced).%><%@ include file="global.jsp" %><% // Load the root forum category ForumCategory rootCategory = forumFactory.getRootForumCategory();%><%@ include file="header.html" %><jsp:include page="breadcrumbs.jsp" flush="true" /><p>Welcome to our online community - please choose a forum below.</p><table id="forum-list" cellpadding="3" cellspacing="2" border="0" width="100%"><tr> <th colspan="2">Forum Name</th> <th>Topics / Messages</th> <th>Last Post</th></tr><% // Start by showing any forums in the root category: Iterator forums = rootCategory.getForums(); while (forums.hasNext()) { Forum forum = (Forum)forums.next();%> <%@ include file="forumRow.jsp" %><% } // Next, loop through the sub-categories in the root category. // Show all categories (as rows) and list the forums contained // in each sub-category: Iterator subCategories = rootCategory.getCategories(); while (subCategories.hasNext()) { ForumCategory subCategory = (ForumCategory)subCategories.next(); // Re-initialize the forums iterator to be an iterator // of forums in the subcategory: forums = subCategory.getForums();%> <tr class="category-row"> <td colspan="4"><%= subCategory.getName() %></td> </tr> <% while (forums.hasNext()) { Forum forum = (Forum)forums.next(); %> <%@ include file="forumRow.jsp" %> <% } // end of while for forums in the sub category } // end of while loop for sub categories%><%@ include file="footer.html" %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -