  | 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
|
|
|
  | | | -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
|
|
 |