'How to solve warning when using liferay-ui:search-container in JSP?
I'm developing a portlet in Liferay 6.1 using Liferay MVC famework. When I use
<liferay-ui:search-container />
Eclipse allways shows me the following warning message
SearchContainer is a raw type. References to generic type
SearhcContainer<R>should be parameterized
JSP code fragment:
<%
List<User> users = UserLocalServiceUtil.search(...);
%>
<liferay-ui:search-container>
<liferay-ui:search-container-results
results="<%= users %>"
total="<%= users.size() %>"
/>
<liferay-ui:search-container-row
className="com.liferay.portal.model.User"
keyProperty="userId"
modelVar="userVar">
<liferay-ui:search-container-column-text
name="name"
value="<%= userVar.getFullName() %>" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
I have searched many examples. I've imported them into my workspace. And they also show me the same Warning message when search-container tag is used.
An example is this portlet: Event listing portlet
in /docroot/html/eventlisting/view.jsp Eclipse shows me the same warning.
I've not found any solution searching nor in google neither in stackoverflow. I have found many references to warnings in jsp, but no when the warning occurs when using some tag.
If it's possible, I don't want to disable JSP Validation or use some @SuppressWarnings.
I would really like to know if there is a correct way to avoid this warning in JSP when I use this taglib.
I'm working with
- Liferay 6.1.1 CE GA2
- Eclipse Luna Release 4.4.0
Thanks in advance
Solution 1:[1]
I think you should use your total attribute in liferay-ui-search-container tag. Instead of using in search-container-result.
List<User> users = UserLocalServiceUtil.search(...);
%>
<liferay-ui:search-container total="<%= users.size() %>">
<liferay-ui:search-container-results
results="<%= users %>"
/>
<liferay-ui:search-container-row
className="com.liferay.portal.model.User"
keyProperty="userId"
modelVar="userVar">
<liferay-ui:search-container-column-text
name="name"
value="<%= userVar.getFullName() %>" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cigien |
