Liferay研究之四:列表显示jsp分析
2007-11-23 14:15
351 查看
显示文章列表的jsp页面是journal_articles/view.jsp,其中用了一个liferay自定义的标签:
<liferay-ui:search-iterator searchContainer="<%= searchContainer %>" />
该标签由:liferay-ui.tld定义,是由:com.liferay.taglib.ui.SearchIteratorTag 来解析的。
从SearchIteratorTag代码中可以知道,里面会调用一个标签属性:paginate,且缺省页面是html/taglib/ui/search_iterator/page.jsp。
从中可以知道,需要先判断是否分页:
<c:if test="<%= paginate %>">
如果需要分页,则调用分页专用的tag标签。
<liferay-ui:search-paginator searchContainer="<%= searchContainer %>" />
之后,通过headerNames来显示表头,如果将其clear,那么就不显示表头。
接下来判断,如果没有查询结果,则显示无结果的显示内容。比如“没有查询结果”之类;
然后设置每行显示的className 样式表类;之后就开始显示表中的内容。注意,row.getEntries()获得一行的所有列,entry.print(pageContext)显示列的内容;
最后显示列表的bottom内容。
<c:if test="<%= (resultRows.size() > 10) && paginate %>">
<div class="taglib-search-iterator-page-iterator-bottom">
<liferay-ui:search-paginator searchContainer="<%= searchContainer %>" />
</div>
</c:if>
这里有点迷糊,不知道这个bottom的具体作用,可能只是添加一个html </form>标记。或者还有什么内容,或者只是与taglib-search-iterator-page-iterator-top成对出现?
此外,有一个Bug, 如果分页点击下一页时会显示下一个记录的详细内容,而不是下一页列表,查看源代码可能是没有设置searchContainer.iteratorURL
显示文章列表信息的相关页面有:
html/taglib/ui/page_iterator/start.jsp
Near 85 line:
<div class="search-results">
<c:choose>
<c:when test="<%= total > resultRowsSize %>">
<%= LanguageUtil.format(pageContext, "showing-x-x-of-x-results", new Object[] {String.valueOf(start + 1), String.valueOf(end), String.valueOf(total)}) %>
</c:when>
<c:otherwise>
<c:choose>
<c:when test="<%= total != 1 %>">
<%= LanguageUtil.format(pageContext, "showing-x-results", String.valueOf(total)) %>
</c:when>
<c:otherwise>
<%= LanguageUtil.format(pageContext, "showing-x-result", String.valueOf(total)) %>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
</div>
将上面代码删除,可不显示:当前共xx条。的文字;
显示:页 xx 的xx ,选择第几页的代码:
Near 105 line (original code):
<div class="page-selector">
<liferay-ui:message key="page" />
<select class="pages <%= namespace %>pageIteratorValue">
<%
for (int i = 1; i <= pages; i++) {
%>
<option <%= (i == curValue) ? "selected=/"selected/"" : "" %> value="<%= i %>"><%= i %></option>
<%
}
%>
</select>
<liferay-ui:message key="of" />
<%= pages %>
<input class="page-iterator-submit" type="submit" value="<liferay-ui:message key="submit" />" />
</div>
显示分页控制的代码:
Near 129 line(original code):
<div class="page-links">
<c:choose>
<c:when test="<%= curValue != 1 %>">
<a class="first" href="<%= _getHREF(formName, curParam, 1, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="first">
</c:otherwise>
</c:choose>
<liferay-ui:message key="first" />
<c:choose>
<c:when test="<%= curValue != 1 %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="<%= curValue != 1 %>">
<a class="previous" href="<%= _getHREF(formName, curParam, curValue - 1, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="previous">
</c:otherwise>
</c:choose>
<liferay-ui:message key="previous" />
<c:choose>
<c:when test="<%= curValue != 1 %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="<%= curValue != pages %>">
<a class="next" href="<%= _getHREF(formName, curParam, curValue + 1, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="next">
</c:otherwise>
</c:choose>
<liferay-ui:message key="next" />
<c:choose>
<c:when test="<%= curValue != pages %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="<%= curValue != pages %>">
<a class="last" href="<%= _getHREF(formName, curParam, pages, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="last">
</c:otherwise>
</c:choose>
<liferay-ui:message key="last" />
<c:choose>
<c:when test="<%= curValue != pages %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
</div>
html/portlet/journal_articles/view.jsp
Near 56 line:
//headerNames.add("name");
//headerNames.add("display-date");
//headerNames.add("author");
将上述代码注释掉之后,可以不显示表的表头。“文章、作者、日期”等。
<liferay-ui:search-iterator searchContainer="<%= searchContainer %>" />
该标签由:liferay-ui.tld定义,是由:com.liferay.taglib.ui.SearchIteratorTag 来解析的。
从SearchIteratorTag代码中可以知道,里面会调用一个标签属性:paginate,且缺省页面是html/taglib/ui/search_iterator/page.jsp。
从中可以知道,需要先判断是否分页:
<c:if test="<%= paginate %>">
如果需要分页,则调用分页专用的tag标签。
<liferay-ui:search-paginator searchContainer="<%= searchContainer %>" />
之后,通过headerNames来显示表头,如果将其clear,那么就不显示表头。
接下来判断,如果没有查询结果,则显示无结果的显示内容。比如“没有查询结果”之类;
然后设置每行显示的className 样式表类;之后就开始显示表中的内容。注意,row.getEntries()获得一行的所有列,entry.print(pageContext)显示列的内容;
最后显示列表的bottom内容。
<c:if test="<%= (resultRows.size() > 10) && paginate %>">
<div class="taglib-search-iterator-page-iterator-bottom">
<liferay-ui:search-paginator searchContainer="<%= searchContainer %>" />
</div>
</c:if>
这里有点迷糊,不知道这个bottom的具体作用,可能只是添加一个html </form>标记。或者还有什么内容,或者只是与taglib-search-iterator-page-iterator-top成对出现?
此外,有一个Bug, 如果分页点击下一页时会显示下一个记录的详细内容,而不是下一页列表,查看源代码可能是没有设置searchContainer.iteratorURL
显示文章列表信息的相关页面有:
html/taglib/ui/page_iterator/start.jsp
Near 85 line:
<div class="search-results">
<c:choose>
<c:when test="<%= total > resultRowsSize %>">
<%= LanguageUtil.format(pageContext, "showing-x-x-of-x-results", new Object[] {String.valueOf(start + 1), String.valueOf(end), String.valueOf(total)}) %>
</c:when>
<c:otherwise>
<c:choose>
<c:when test="<%= total != 1 %>">
<%= LanguageUtil.format(pageContext, "showing-x-results", String.valueOf(total)) %>
</c:when>
<c:otherwise>
<%= LanguageUtil.format(pageContext, "showing-x-result", String.valueOf(total)) %>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
</div>
将上面代码删除,可不显示:当前共xx条。的文字;
显示:页 xx 的xx ,选择第几页的代码:
Near 105 line (original code):
<div class="page-selector">
<liferay-ui:message key="page" />
<select class="pages <%= namespace %>pageIteratorValue">
<%
for (int i = 1; i <= pages; i++) {
%>
<option <%= (i == curValue) ? "selected=/"selected/"" : "" %> value="<%= i %>"><%= i %></option>
<%
}
%>
</select>
<liferay-ui:message key="of" />
<%= pages %>
<input class="page-iterator-submit" type="submit" value="<liferay-ui:message key="submit" />" />
</div>
显示分页控制的代码:
Near 129 line(original code):
<div class="page-links">
<c:choose>
<c:when test="<%= curValue != 1 %>">
<a class="first" href="<%= _getHREF(formName, curParam, 1, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="first">
</c:otherwise>
</c:choose>
<liferay-ui:message key="first" />
<c:choose>
<c:when test="<%= curValue != 1 %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="<%= curValue != 1 %>">
<a class="previous" href="<%= _getHREF(formName, curParam, curValue - 1, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="previous">
</c:otherwise>
</c:choose>
<liferay-ui:message key="previous" />
<c:choose>
<c:when test="<%= curValue != 1 %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="<%= curValue != pages %>">
<a class="next" href="<%= _getHREF(formName, curParam, curValue + 1, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="next">
</c:otherwise>
</c:choose>
<liferay-ui:message key="next" />
<c:choose>
<c:when test="<%= curValue != pages %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="<%= curValue != pages %>">
<a class="last" href="<%= _getHREF(formName, curParam, pages, jsCall, url, urlAnchor) %>" target="<%= target %>">
</c:when>
<c:otherwise>
<span class="last">
</c:otherwise>
</c:choose>
<liferay-ui:message key="last" />
<c:choose>
<c:when test="<%= curValue != pages %>">
</a>
</c:when>
<c:otherwise>
</span>
</c:otherwise>
</c:choose>
</div>
html/portlet/journal_articles/view.jsp
Near 56 line:
//headerNames.add("name");
//headerNames.add("display-date");
//headerNames.add("author");
将上述代码注释掉之后,可以不显示表的表头。“文章、作者、日期”等。
相关文章推荐
- 第二人生的源码分析(九十)LLScrollListCtrl实现列表显示
- Liferay研究之廿七:一些有用的API分析
- jsp的修改页面中怎么样获取到复选框和下拉列表里面的信息然后显示在修改页面
- JSP页面以下拉列表的形式显示后台的数据
- Android编程之短信列表的时间显示实例分析
- 第二人生的源码分析(九十)LLScrollListCtrl实现列表显示
- 分析petshop3.0显示产品列表
- Owner –Drawn 自绘列表框框的原理分析和研究
- Shop项目--12. 显示用户订单列表order_list.jsp
- Skia深入分析9——延迟渲染和显示列表
- jsp实现在线用户列表显示
- (2)jBPM websale代码学习: home.jsp(显示任务列表)
- JSP列表形式显示数据库中的数据 OracleCachedRowSet 实例
- 一个页面实现修改删除列表显示,ajax动态生成table(使用ajax,springmvc,jsp)
- JSP中java脚本显示所有的书籍列表
- JSP定制标记——分析java.util.Locale,根据地区选择显示日期的标记
- Liferay研究之十二:对Liferay框架的几点分析总结
- 第二人生的源码分析(九十)LLScrollListCtrl实现列表显示
- Skia深入分析9——延迟渲染和显示列表
- 使用jsp自定义标签库实现数据列表显示模拟cms4j中的标签库效果