Author: kcardineaud Date: 2011-07-01 14:39:28 +0200 (Fri, 01 Jul 2011) New Revision: 152 Url: http://nuiton.org/repositories/revision/scmwebeditor/152 Log: Use taglib to display the search result on the repository Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java trunk/src/main/webapp/Search.jsp Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java 2011-07-01 09:59:44 UTC (rev 151) +++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java 2011-07-01 12:39:28 UTC (rev 152) @@ -41,13 +41,21 @@ LinkedList<UrlSvnFile> files; String username; String pw; + String error; + + String info; String list; + public String getError() { + return error; + } + + public String getList() { return list; } @@ -103,7 +111,7 @@ String url = address; - + String name = "anonymous"; String password="anonymous"; @@ -137,11 +145,13 @@ if(log.isErrorEnabled()) { log.error( "There is no entry at '" + url + "'." ); } + error="There is no entry at '" + url + "'."; return Action.SUCCESS; } else if ( nodeKind == SVNNodeKind.FILE ) { if(log.isErrorEnabled()) { log.error( "The entry at '" + url + "' is a file while a directory was expected." ); } + error="The entry is a file while a directory was expected."; return Action.SUCCESS; } @@ -149,11 +159,16 @@ Collections.sort(files); } catch (SVNAuthenticationException authexep) { - log.error("Can't access to the repository : Auth Problem"); + if(log.isErrorEnabled()) { + log.error("Can't access to the repository : Auth Problem"); + } return "authError"; } catch ( SVNException svne ) { - log.error("Can't access to the repository",svne); + if(log.isErrorEnabled()) { + log.error("Can't access to the repository"); + } + error="Can't access to the repository"; } Modified: trunk/src/main/webapp/Search.jsp =================================================================== --- trunk/src/main/webapp/Search.jsp 2011-07-01 09:59:44 UTC (rev 151) +++ trunk/src/main/webapp/Search.jsp 2011-07-01 12:39:28 UTC (rev 152) @@ -1,45 +1,23 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@page import="org.nuiton.scmwebeditor.actions.SearchAction"%> -<%@page import="java.util.LinkedList" %> -<%@page import="java.util.Iterator" %> -<%@page import="org.nuiton.scmwebeditor.UrlSvnFile" %> <%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%> <sj:head jquerytheme="default"/> <div id="search"> - <% - SearchAction action = SearchAction.getAction(); - - LinkedList<UrlSvnFile> files = action.getFiles(); - - Iterator<UrlSvnFile> it = files.iterator(); - - if(!files.isEmpty()) { - %> - <p>Files in the SVN repository : </p> - <% - while(it.hasNext()) { - UrlSvnFile file = it.next(); - %> - - <table> - <tr><td> - <a href="checkout.action?address=<%=file%>" ><%=file+" "+file.getLevel()%></a> - - </td></tr> - </table> - <% } - } - - else { - %> + <s:form action="search"> + + <s:if test="!files.empty"> + <p>Files on the repository : </p> + <table> + <s:iterator value="files"> + <tr><td><a href="checkout.action?address=<s:property/>"><s:property/> <s:property value="level"/></a></td></tr> + </s:iterator> + </table> + </s:if> - <p>This is not a repository.</p> - <% - } - %> - + <s:label name="error"></s:label> + </s:form> + </div> \ No newline at end of file