Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
-none-

-none-

2007-09-03       - By Marc Eckart

 Back
Hi,

I use Displaytag and want to use the sorting capability. So I configured the
displaytag to go to a empty action, because my list is in the session -
nothing should be loaded again, just using the existing search results.

       <display:table uid="row" name="searchResults" pagesize="15"
sort="list" requestURI="/showResultList.action" cellspacing="0"
cellpadding="0">
             <display:column property="ipNbr" title="" decorator="
de.seb.bpc.search.presentation.decorators.RadioButtonColumnDecorator"/>
            ....
      </display:table>

If I do this, I get a 404 error that the ressource which is defined in my
struts.xml could not be found. I debugged the execution of the action and
struts goes into the action and returns the "success" string" and I get the
error.

If I put just an empty string into requestURI of the displaytag the action
which performs the search and returns the searchresults by putting a
collection into the session returns to the jsp without the ressource not
found error.

But I looked into the empty action and my searchresults were still in the
session.

The empty action in the struts.xml

       <action name="showResultList" class="
de.bpc.search.presentation.SearchAction" method="showResultList">
           <result name="success">/involved_party_search.jsp</result>
       </action>

And the working action:

       <action name="internalSearch" class="
de.bpc.search.presentation.SearchAction" method="internalSearch">
           <result
name="success">/WEB-INF/jsp/searchInvolvedParty.jsp</result>
           <result name="error">/WEB-INF/jsp/error.jsp</result>
           <result
name="errorValidation">/WEB-INF/jsp/searchInvolvedParty.jsp</result>
           <result
name="showParamHelp">/WEB-INF/jsp/showParamHelp.jsp</result>
       </action>

And the java code:

package de.seb.bpc.search.presentation;

.....

public class SearchAction extends SearchSupport {

    public String internalSearch() throws Exception {

        log.debug("internalSearch.... ");

       /*if (getUserId() == null)
           return "errorUserId";*/

       ArrayList<String> errorList = InputParamValidator.validate
(getInputParameters());
       if (errorList.size() > 0) {
           for (int i=0 ; i < errorList.size(); i++) {
               log.error(getText(errorList.get(i)));
               addActionError(getText(errorList.get(i)));
           }
           return "showParamHelp";
       }

       clearSimpleSearchDefaultValue(getSearchCriteria());
       setSelectedIpFromGlobalContext();
       clearSeachResults();
       getSearchCriteria().trim();

       log.debug("internalSearch: \n" + getSearchCriteria().toString());
       log.debug("searchTypeString: " + getSearchTypeString());

       // validate the given searchCriteria, the searchType is returned
       // the validation resets the searchCriteria of all not selected tabs
!!!
       SearchType searchType = SearchType.valueOf(this.getSearchTypeString
());
       searchType = SearchCriteriaValidator.validateSearchCriteria
(getSearchCriteria(),searchType);
       log.debug("searchType after validation: " + searchType);

       // add actionErrors if searchCriteria not valid
       if (SearchCriteriaValidator.getErrorList().size() > 0) {
           log.error("validation of searchCriteria not successful");
           //setActionErrors(SearchCriteriaValidator.getErrorList());
           for (int i=0 ; i < SearchCriteriaValidator.getErrorList().size();
i++) {
               log.error(getText(SearchCriteriaValidator.getErrorList
().get(i)));
               addActionError(getText(SearchCriteriaValidator.getErrorList
().get(i)));
           }
           return "errorValidation";
       }


       // perform search
       try {
           SearchResults results = SearchDispatcher.performSearch(searchType,
getUserId(), getSearchCriteria());
           if (!results.hasErrorMessages()) {
               setSearchResults (results.getInvolvedParties());
               if (results.isMoreDataAvaible()) {
                   addActionMessage(getText("info.search.more.data"));
               }
           } else {
               Iterator<String> it =
(Iterator<String>)results.getErrorMessages().iterator();
               while (it.hasNext()) addActionError(it.next());
           }
       } catch (ServiceAdapterException saex) {
           addActionError(getText("error.search.intern.severe")+" :
"+saex.getMessage()+" | Returncode: "+saex.getReturnCode());
       } catch (Exception ex) {
           if (searchType.equals(Constants.SearchType.SEARCH_BY_NAME) && (
ex.getMessage().indexOf("TIMEOUT: no messages received") != -1)) {
               String[] args = {PropertyUtil.getInitParameter("
searchByName.timeout")};
               addActionError(getText("error.search.timeout", args));

           } else throw ex;
       }

       // if nothing found set action message
       if(getSearchResults() == null) {
           addActionMessage(getText("info.search.not.found"));
       }

       return "success";
   }

    public String showResultList() {
        log.debug("showResultList");
        return "success";
    }
}


At the end for forwarding to the right jsp just the return string should
matter - or am I wrong?

I have no glue what is wrong :-(

Best Regards,
Marc

©2008 junlu.com - Jax Systems, LLC, U.S.A.