<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello to all,<br>
I'm trying to write the version of a document in the search result, and
I've done the code that I detailed in red, but this doesn't work, any
idea?<br>
<br>
The error is:<br>
<br>
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 11 in the jsp file:
/WEB-INF/jsp/offline/system/modules/es.alcatelbarcelonadesigncenter.aww/result8.jsp
Generated servlet error:
CmsVersionWrapper cannot be resolved
An error occurred at line: 118 in the jsp file:
/WEB-INF/jsp/offline/system/modules/es.alcatelbarcelonadesigncenter.aww/result8.jsp
Generated servlet error:
h cannot be resolved at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
at org.apache.jasper.compiler.JDTCompiler<br>
<blockquote cite="mid44D3601C.8020106@alcatel.es" type="cite"><br>
<br>
<br>
<br>
<%@ page buffer="none" import="org.opencms.main.*, <b><font
color="#cc0000">org.opencms.workplace.commons.CmsHistoryList.*</font></b>,
org.opencms.search.*, org.opencms.file.*, org.opencms.util.*,
org.opencms.jsp.*, java.util.*" %><br>
<br>
<br>
<% // Create a JSP action element<br>
org.opencms.jsp.CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);<br>
<br>
// Get the search manager<br>
CmsSearchManager searchManager = OpenCms.getSearchManager(); <br>
%><br>
<br>
<b><font color="#cc0000"><%! private<br>
CmsVersionWrapper getVersion(CmsObject cmsh, String resourcePath)<br>
<br>
throws CmsException {<br>
CmsVersionWrapper = null;<br>
if (cmsh != null && resourcePath != null) {<br>
CmsResource h = cmsh.readResource(resourcePath);<br>
<br>
}<br>
<br>
}<br>
<br>
<br>
%></font></b><br>
<br>
<br>
<br>
<%! private<br>
CmsUser getUserCreated(CmsObject cmso, String resourcePath)<br>
throws CmsException {<br>
CmsUser user = null;<br>
<br>
if (cmso != null && resourcePath != null) {<br>
CmsResource r = cmso.readResource(resourcePath);<br>
CmsUUID uuid = r.getUserCreated();<br>
<br>
List users = cmso.getUsers(CmsUser.USER_TYPE_SYSTEMUSER);<br>
for (Iterator it = users.iterator(); it.hasNext(); ) {<br>
CmsUser u = (CmsUser)it.next();<br>
if (u.getId().equals(uuid)) {<br>
user = u;<br>
break;<br>
}<br>
}<br>
}<br>
<br>
return user;<br>
}<br>
%><br>
<br>
<br>
<jsp:useBean id="search" scope="request"
class="org.opencms.search.CmsSearch"><br>
<jsp:setProperty name = "search" property="matchesPerPage"
param="matchesperpage"/><br>
<jsp:setProperty name = "search" property="displayPages"
param="displaypages"/><br>
<jsp:setProperty name = "search" property="*"/><br>
<% <br>
search.init(cms.getCmsObject()); <br>
%><br>
</jsp:useBean><br>
<br>
<html><br>
<head><br>
<title>Search result</title><br>
</head><br>
<br>
<body><br>
<img src=resources/logo_opencms_large.png alt="Alcatel Logo"
title="Alcatel Logo" width="250" height="63" border="0"
align="right"><br>
<h1>Search result</h1><br>
<br>
<%<br>
int resultno = 1;<br>
int pageno = 0;<br>
if (request.getParameter("searchPage")!=null) { <br>
pageno = Integer.parseInt(request.getParameter("searchPage"))-1;<br>
}<br>
resultno = (pageno*search.getMatchesPerPage())+1;<br>
<br>
String fields = search.getFields();<br>
if (fields==null) {<br>
fields = request.getParameter("fields");<br>
}<br>
<br>
List result = search.getSearchResult();<br>
if (result == null) {<br>
%><br>
<%<br>
if (search.getLastException() != null) { <br>
%><br>
<h3>Error</h3><br>
<%= search.getLastException().toString() %> <br>
<%<br>
}<br>
<br>
} else {<br>
<br>
ListIterator iterator = result.listIterator();<br>
%><br>
<h3><%= search.getSearchResult().size() %> Results found
for query <<%= search.getQuery() %>> in fields
<%= fields %></h3><br>
<%<br>
while (iterator.hasNext()) {<br>
CmsSearchResult entry = (CmsSearchResult)iterator.next();<br>
%><br>
<br>
<h3><%= resultno %>. <a
href="<%=
cms.link(cms.getRequestContext().removeSiteRoot(entry.getPath()))
%>"><%= entry.getTitle() %></a> (<%=
entry.getScore() %>%)</h3><br>
<h4>Keywords</h6><br>
<%= entry.getKeywords() %><br>
<h4>Content</h6><br>
<%= entry.getExcerpt() %><br>
<h4>Description</h6><br>
<%= entry.getDescription() %><br>
<h4>Last Modified Date</h6><br>
<%= entry.getDateLastModified() %><br>
<h4>Created by</h6><br>
<%= getUserCreated(<br>
cms.getCmsObject(),<br>
entry.getPath()).getFullName()
%><br>
<b><font color="#cc0000"> <h4>Version</h6><br>
<%= h.getVersion() %></font></b><br>
<br>
<br>
<br>
<HTML><br>
<br>
<HEAD><br>
<br>
</HEAD><br>
<br>
<BODY><br>
<BR><br>
<BR><br>
<BR><br>
</BODY><br>
<br>
</HTML><br>
<br>
<br>
<br>
<%<br>
resultno++; <br>
}<br>
}<br>
%> <br>
<%<br>
if (search.getPreviousUrl() != null) {<br>
%><br>
<input type="button" value="<< previous"
onclick="location.href='<%= cms.link(search.getPreviousUrl())
%>&fields=<%= fields %>';"><br>
<%<br>
}<br>
Map pageLinks = search.getPageLinks();<br>
Iterator i = pageLinks.keySet().iterator();<br>
while (i.hasNext()) {<br>
int pageNumber = ((Integer)i.next()).intValue();<br>
String pageLink = cms.link((String)pageLinks.get(new
Integer(pageNumber))); <br>
out.print(" ");<br>
if (pageNumber != search.getSearchPage()) {<br>
%><br>
<a href="<%= pageLink %>&fields=<%= fields
%>"><%= pageNumber %></a><br>
<%<br>
} else {<br>
%><br>
<span class="currentpage"><%= pageNumber
%></span><br>
<%<br>
}<br>
}<br>
if (search.getNextUrl() != null) {<br>
%><br>
<input type="button" value="next
>>" onclick="location.href='<%=
cms.link(search.getNextUrl()) %>&fields=<%= fields
%>';"><br>
<%<br>
} <br>
<br>
%><br>
<br>
</body>
</blockquote>
<br>
</body>
</html>