[opencms-dev] Re: Listar en el result del search la versión del documento

maria.freixes_graells at alcatel.es maria.freixes_graells at alcatel.es
Fri Aug 4 17:06:50 CEST 2006


Hello to all,
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?

The error is:

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
>
>
>
>
> <%@ page buffer="none" import="org.opencms.main.*, 
> *org.opencms.workplace.commons.CmsHistoryList.**, 
> org.opencms.search.*, org.opencms.file.*, org.opencms.util.*, 
> org.opencms.jsp.*, java.util.*" %>
>
>
> <%    // Create a JSP action element
>     org.opencms.jsp.CmsJspActionElement cms = new 
> CmsJspActionElement(pageContext, request, response);
>     
>     // Get the search manager
>     CmsSearchManager searchManager = OpenCms.getSearchManager();
> %>
>
> *<%! private
>  CmsVersionWrapper getVersion(CmsObject cmsh, String resourcePath)
>          
>  throws CmsException {
>        CmsVersionWrapper = null;
>         if (cmsh != null && resourcePath != null) {
>             CmsResource h = cmsh.readResource(resourcePath);
>              
> }
>            
>             }
>       
>     
> %>*
>
>
>
> <%! private
>  CmsUser getUserCreated(CmsObject cmso, String resourcePath)
>             throws CmsException {
>         CmsUser user = null;
>
>         if (cmso != null && resourcePath != null) {
>             CmsResource r = cmso.readResource(resourcePath);
>             CmsUUID uuid = r.getUserCreated();
>
>             List users = cmso.getUsers(CmsUser.USER_TYPE_SYSTEMUSER);
>             for (Iterator it = users.iterator(); it.hasNext(); ) {
>                 CmsUser u = (CmsUser)it.next();
>                 if (u.getId().equals(uuid)) {
>                     user = u;
>                     break;
>                 }
>             }
>         }
>
>         return user;
>     }
> %>
>
>
> <jsp:useBean id="search" scope="request" 
> class="org.opencms.search.CmsSearch">
>     <jsp:setProperty name = "search" property="matchesPerPage" 
> param="matchesperpage"/>
>     <jsp:setProperty name = "search" property="displayPages" 
> param="displaypages"/>
>     <jsp:setProperty name = "search" property="*"/>
>     <%
>             search.init(cms.getCmsObject());         
>     %>
> </jsp:useBean>
>
> <html>
> <head>
> <title>Search result</title>
> </head>
>
> <body>
> <img src=resources/logo_opencms_large.png alt="Alcatel Logo" 
> title="Alcatel Logo" width="250" height="63" border="0" align="right">
> <h1>Search result</h1>
>
> <%
>     int resultno = 1;
>     int pageno = 0;
>     if (request.getParameter("searchPage")!=null) {        
>         pageno = Integer.parseInt(request.getParameter("searchPage"))-1;
>     }
>     resultno = (pageno*search.getMatchesPerPage())+1;
>     
>     String fields = search.getFields();
>    if (fields==null) {
>        fields = request.getParameter("fields");
>    }
>     
>    List result = search.getSearchResult();
>    if (result == null) {
> %>
> <%
>         if (search.getLastException() != null) {
> %>
> <h3>Error</h3>
> <%= search.getLastException().toString() %>
> <%
>         }
>
>     } else {
>     
>         ListIterator iterator = result.listIterator();
> %>
> <h3><%= search.getSearchResult().size() %> Results found for query 
> <<%= search.getQuery() %>> in fields <%= fields %></h3>
> <%
>         while (iterator.hasNext()) {
>             CmsSearchResult entry = (CmsSearchResult)iterator.next();
> %>
>
>                 <h3><%= resultno %>. <a href="<%= 
> cms.link(cms.getRequestContext().removeSiteRoot(entry.getPath())) 
> %>"><%= entry.getTitle() %></a> (<%= entry.getScore() %>%)</h3>
>                 <h4>Keywords</h6>
>                 <%= entry.getKeywords() %>
>                 <h4>Content</h6>
>                 <%= entry.getExcerpt() %>
>                 <h4>Description</h6>
>                 <%= entry.getDescription() %>
>                                 <h4>Last Modified Date</h6>
>                                 <%= entry.getDateLastModified() %>
>                                 <h4>Created by</h6>
>                                 <%= getUserCreated(
>                                      cms.getCmsObject(),
>                                      entry.getPath()).getFullName() %>
>                * <h4>Version</h6>
>                 <%= h.getVersion() %>*
>
>
>                                    
> <HTML>
>
> <HEAD>
>
> </HEAD>
>
> <BODY>
> <BR>
> <BR>
> <BR>
> </BODY>
>
> </HTML>
>                               
>                                 
>
> <%
>         resultno++;            
>         }
>     }
> %>
> <%
>     if (search.getPreviousUrl() != null) {
> %>
>         <input type="button" value="<< previous" 
> onclick="location.href='<%= cms.link(search.getPreviousUrl()) 
> %>&fields=<%= fields %>';">
> <%
>     }
>     Map pageLinks = search.getPageLinks();
>     Iterator i =  pageLinks.keySet().iterator();
>     while (i.hasNext()) {
>         int pageNumber = ((Integer)i.next()).intValue();
>         String pageLink = cms.link((String)pageLinks.get(new 
> Integer(pageNumber)));    
>         out.print("   ");
>         if (pageNumber != search.getSearchPage()) {
> %>
>             <a href="<%= pageLink %>&fields=<%= fields %>"><%= 
> pageNumber %></a>
> <%
>         } else {
> %>
>             <span class="currentpage"><%= pageNumber %></span>
> <%
>         }
>     }
>     if (search.getNextUrl() != null) {
> %>
>            <input type="button" value="next >>" 
> onclick="location.href='<%= cms.link(search.getNextUrl()) 
> %>&fields=<%= fields %>';">
> <%
>     }
>     
> %>
>             
> </body> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060804/f9aa949c/attachment.htm>


More information about the opencms-dev mailing list