为什么searchContainer变量未知? [英] Why the searchContainer variable is unknown?

查看:59
本文介绍了为什么searchContainer变量未知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用searchContainerliferay 6.1.一起做一个简单的例子

I'm trying to do a simple example with the searchContainer working with liferay 6.1.

searchContainer variableview.jsp.中是未知的 我收到错误"searchContainer cannot be resolved".

The searchContainer variable is unknown in view.jsp. I get the error "searchContainer cannot be resolved".

我尝试加入<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>

那没有用.

代码如下:

<liferay-ui:search-container iteratorURL="<%= actionURL %>" delta="10" emptyResultsMessage="no-documents">
<liferay-ui:search-container-results total="<%= list.size() %>" results="<%= ListUtil.subList(list, searchContainer.getStart(), searchContainer.getEnd()) %>" />

更新

我正在search-container-results标签和search-iterator标签

 <liferay-ui:search-container iteratorURL="<%= actionURL %>"
     delta="10" emptyResultsMessage="no-documents">
         <liferay-ui:search-container-results total="<%= list.size() %>"
         results="<%= ListUtil.subList(list, searchContainer.getStart(), 
         searchContainer.getEnd()) %>" />
         <liferay-ui:search-container-row modelVar="file        
         className="DLFileEntry">
         .
         .
         .
         </liferay-ui:search-container-row>
         <liferay-ui:search-iterator
          searchContainer="<%= searchContainer %>"
          paginate="${fn:length(listFiles) ge 10}" />
 </liferay-ui:search-container>

推荐答案

原则上,您的代码应该可以工作.我会按概率顺序查找这些选项:

In principle your code should work. I'd look for these options, in order of probability:

  1. 在使用search-container-results标记之前,要么先单击search-container标记,否则searchContainer会超出范围. (假设您可能在此处缩短了代码,或者您对searchContainer有了另一个引用,而不仅仅是在这里显示的那个.
  2. 或者您正在明确声明该变量的名称不同,例如<liferay-ui:search-container var="myOwnNameForSearchContainer" ...>,再次假设您已在此处严重缩短了示例代码
  3. 或无法识别标签库(低概率).
  1. Either you're cl the search-container tag before you use the search-container-results tag, thus searchContainer would be out of scope. (assuming you might have shortened the code here, or you have another reference to searchContainer, not just the one that you're showing here.
  2. or you're declaring the variable explicitly to be named differently, e.g. <liferay-ui:search-container var="myOwnNameForSearchContainer" ...>, again this assumes that you've severely shortened the sample code here
  3. or the tag library is not recognized (low probability).

如何缓解?

  1. 在页面的后面要特别注意searchContainer的其他引用,
  2. 应该很明显
  3. 将页面缩小为<liferay-ui:searchContainer ... > </liferay-ui:search-container>,并确保将其替换为实际的HTML代码,并且在呈现页面并添加各个其他元素时,HTML输出中不再存在此特定标记.
  1. Watch out for other references to searchContainer later on the page, particularly after the occurrence of </liferay-ui:search-container>.
  2. should be obvious
  3. Shorten the page to just <liferay-ui:searchContainer ... > </liferay-ui:search-container> and make sure that this gets replaced with actual HTML code, and this particular markup is no longer existing in the HTML output when you render the page, then add individual other elements.

这篇关于为什么searchContainer变量未知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆