Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
mike lee priest
Recent Documents replica - JSP error
February 24, 2010 12:43 PM
Answer

mike lee priest

Rank: New Member

Posts: 3

Join Date: December 7, 2009

Recent Posts

Hey I am trying to replicate the recent documents portlet in a plug-in. This is a small part of my elaborate plan...

Any ways, I am getting a JSP error when I import a Utils class.

Here is my code

Init.jsp
---------------------------
 1
 2
 3
 4LOTS of imports here....
 5
 6<%@ page import="com.liferay.portlet.documentlibrary.model.DLFileEntry" %>
 7<%@ page import="com.liferay.portlet.documentlibrary.model.DLFileRank" %>
 8<%@ page import="com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil" %>
 9<%@ page import="com.liferay.portlet.documentlibrary.service.DLFileRankLocalServiceUtil" %>
10<%@ page import="com.liferay.portlet.documentlibrary.util.DLUtil" %>


View.jsp
---------------------------
 1
 2
 3<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
 4<portlet:defineObjects />
 5
 6<%@ include file="init.jsp" %>
 7<%
 8List fileRanks = DLFileRankLocalServiceUtil.getFileRanks(scopeGroupId, user.getUserId(), 0, SearchContainer.DEFAULT_DELTA);
 9%>
10
11<c:choose>
12    <c:when test="<%= fileRanks.size() == 0 %>">
13        <liferay-ui:message key="there-are-no-recent-documents" />
14    </c:when>
15    <c:otherwise>
16        <table class="lfr-table">
17        <%
18        for (int i = 0; i < fileRanks.size(); i++) {
19            DLFileRank fileRank = (DLFileRank)fileRanks.get(i);
20
21            try {
22                DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntry(fileRank.getFolderId(), fileRank.getName());
23
24                fileEntry = fileEntry.toEscapedModel();
25
26                PortletURL rowURL = renderResponse.createActionURL();
27
28                rowURL.setWindowState(LiferayWindowState.EXCLUSIVE);
29
30                rowURL.setParameter("struts_action", "/recent_documents/get_file");
31                rowURL.setParameter("folderId", String.valueOf(fileRank.getFolderId()));
32                rowURL.setParameter("name", HtmlUtil.unescape(fileRank.getName()));
33        %>
34                <tr>
35                    <td>
36                        <a href="<%= rowURL.toString() %>"><img align="left" border="0" src="<%= themeDisplay.getPathThemeImages() %>/document_library/<%= DLUtil.getFileExtension(fileRank.getName()) %>.png" /><%= fileEntry.getTitleWithExtension() %></a>
37                    </td>
38                </tr>
39        <%
40            }
41            catch (Exception e) {
42            }
43        }
44        %>
45        </table>
46    </c:otherwise>
47</c:choose>



So what happens is Tomcat throws an error....

An error occurred at line: 65 in the generated java file
Only a type can be imported. com.liferay.portlet.documentlibrary.util.DLUtil resolves to a package

Now i know this must be because its not on my class path but I have no idea where this class is to put it on my class path. I have included the SDK both ext and portal in my class path????

Am i missing something ......??????

Also, is any one interested in seeing a jQuery carousel portlet for EE. I just developed one and want to put it on open source project if anyone has interest. Its pretty cool.
S L B
RE: Recent Documents replica - JSP error
March 18, 2011 11:27 AM
Answer

S L B

Rank: New Member

Posts: 23

Join Date: July 28, 2008

Recent Posts

Are you deploying directly to tomcat or using the liferay hot deployment folder/control panel thingy? I had a problem like this and it was because I was dropping the war straight into webapps.