Re: Problem with displayTag
You need to set hte requestURI attribute see http://displaytag.sourceforge.net/1.2/displaytag/tagreference.html#display-el:table On Mon, Jun 8, 2009 at 12:11 PM, Bhaarat Sharma wrote: > Hi guys, > I'm starting displaytag for the first time. > > I have a simple Struts2 action that is returning a list. The list contains > elements of Class Apple. > > Following is the code I have: > > > > > > > > > This works ok, however, when I click 'next page' the page says 'Nothing > found to display.' > > Does anyone know how to fix this? > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Problem with displayTag
Hi guys, I'm starting displaytag for the first time. I have a simple Struts2 action that is returning a list. The list contains elements of Class Apple. Following is the code I have: This works ok, however, when I click 'next page' the page says 'Nothing found to display.' Does anyone know how to fix this?
Sorting Problem with Displaytag and Struts2
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. 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 /involved_party_search.jsp And the working action: /WEB-INF/jsp/searchInvolvedParty.jsp /WEB-INF/jsp/error.jsp /WEB-INF/jsp/searchInvolvedParty.jsp /WEB-INF/jsp/showParamHelp.jsp 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 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 it = (Iterator)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
Re: [OT] problem with displaytag column sorting in struts 1.2 web project
Awesome, worked like a charm. Thanks a ton ! Tim Williams wrote: > > Just put requestURI="/mypage.do" (where mypage.do==the page that > displays the table). > > --tim > > On 4/8/07, robinbajaj <[EMAIL PROTECTED]> wrote: >> >> thanks for the tip. >> can you please provide more specific example/code-snippet for using the >> requestURI attribute. i couldnt find enough documentation on this >> feature. >> thanks in advance, >> robin >> >> >> Tim Williams wrote: >> > >> > On 4/8/07, robin bajaj <[EMAIL PROTECTED]> wrote: >> >> Hi All, >> >> In my Struts 1.2.x webapp, I am getting some Patient records from >> >> backend using my PatientManager businessObject (which uses Hibernate) >> >> to send back a populated Patients List in the request scope. (Patient >> is >> >> my bean). >> >> >> >> I am feeding this patientsList to Displaytag table, >> >> to show the data in a table. >> >> >> >> Here's the code snippet for my jsp containing displaytag table. >> >> http://rafb.net/p/artIJr98.html >> >> >> >> Now, I want to sort this table based on the PatientID >> >> when I click on the PatientID column. >> >> >> >> I read in the Displaytag docs >> >> >> >> >> http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp >> >> >> >> where it mentions the following : >> >> >> >> If you want to allow the user to sort the data as it is coming back, >> >> then you need to just do two things, make sure that the data returned >> >> from your property implements the Comparable interface (if it doesn't >> >> natively - use the decorator pattern as shown a couple of examples >> ago), >> >> and then set the attribute sortable="true" on the columns that you >> want >> >> to be able to sort by. >> >> >> >> >> >> Following the above suggestion, I changed my Patient class to >> implement >> >> Comparable interface and implemented the following compareTo method >> (as >> >> following) >> >> http://rafb.net/p/t0CR4Q98.html >> >> >> >> Then I re-build my app and restart it on the server, the displaytag >> >> table shows up fine. But when I click on the first column PtId, it >> >> doesn't sort the table. I just get the Http404 error page. >> >> >> >> Am I missing something ? >> > >> > Try setting the requestURI attribute of the table itself? >> > --tim >> > >> > - >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/-OT--problem-with-displaytag-column-sorting-in-struts-1.2-web-project-tf3543922.html#a9895137 >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-OT--problem-with-displaytag-column-sorting-in-struts-1.2-web-project-tf3543922.html#a9908623 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] problem with displaytag column sorting in struts 1.2 web project
Just put requestURI="/mypage.do" (where mypage.do==the page that displays the table). --tim On 4/8/07, robinbajaj <[EMAIL PROTECTED]> wrote: thanks for the tip. can you please provide more specific example/code-snippet for using the requestURI attribute. i couldnt find enough documentation on this feature. thanks in advance, robin Tim Williams wrote: > > On 4/8/07, robin bajaj <[EMAIL PROTECTED]> wrote: >> Hi All, >> In my Struts 1.2.x webapp, I am getting some Patient records from >> backend using my PatientManager businessObject (which uses Hibernate) >> to send back a populated Patients List in the request scope. (Patient is >> my bean). >> >> I am feeding this patientsList to Displaytag table, >> to show the data in a table. >> >> Here's the code snippet for my jsp containing displaytag table. >> http://rafb.net/p/artIJr98.html >> >> Now, I want to sort this table based on the PatientID >> when I click on the PatientID column. >> >> I read in the Displaytag docs >> >> http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp >> >> where it mentions the following : >> >> If you want to allow the user to sort the data as it is coming back, >> then you need to just do two things, make sure that the data returned >> from your property implements the Comparable interface (if it doesn't >> natively - use the decorator pattern as shown a couple of examples ago), >> and then set the attribute sortable="true" on the columns that you want >> to be able to sort by. >> >> >> Following the above suggestion, I changed my Patient class to implement >> Comparable interface and implemented the following compareTo method (as >> following) >> http://rafb.net/p/t0CR4Q98.html >> >> Then I re-build my app and restart it on the server, the displaytag >> table shows up fine. But when I click on the first column PtId, it >> doesn't sort the table. I just get the Http404 error page. >> >> Am I missing something ? > > Try setting the requestURI attribute of the table itself? > --tim > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-OT--problem-with-displaytag-column-sorting-in-struts-1.2-web-project-tf3543922.html#a9895137 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] problem with displaytag column sorting in struts 1.2 web project
thanks for the tip. can you please provide more specific example/code-snippet for using the requestURI attribute. i couldnt find enough documentation on this feature. thanks in advance, robin Tim Williams wrote: > > On 4/8/07, robin bajaj <[EMAIL PROTECTED]> wrote: >> Hi All, >> In my Struts 1.2.x webapp, I am getting some Patient records from >> backend using my PatientManager businessObject (which uses Hibernate) >> to send back a populated Patients List in the request scope. (Patient is >> my bean). >> >> I am feeding this patientsList to Displaytag table, >> to show the data in a table. >> >> Here's the code snippet for my jsp containing displaytag table. >> http://rafb.net/p/artIJr98.html >> >> Now, I want to sort this table based on the PatientID >> when I click on the PatientID column. >> >> I read in the Displaytag docs >> >> http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp >> >> where it mentions the following : >> >> If you want to allow the user to sort the data as it is coming back, >> then you need to just do two things, make sure that the data returned >> from your property implements the Comparable interface (if it doesn't >> natively - use the decorator pattern as shown a couple of examples ago), >> and then set the attribute sortable="true" on the columns that you want >> to be able to sort by. >> >> >> Following the above suggestion, I changed my Patient class to implement >> Comparable interface and implemented the following compareTo method (as >> following) >> http://rafb.net/p/t0CR4Q98.html >> >> Then I re-build my app and restart it on the server, the displaytag >> table shows up fine. But when I click on the first column PtId, it >> doesn't sort the table. I just get the Http404 error page. >> >> Am I missing something ? > > Try setting the requestURI attribute of the table itself? > --tim > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-OT--problem-with-displaytag-column-sorting-in-struts-1.2-web-project-tf3543922.html#a9895137 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] problem with displaytag column sorting in struts 1.2 web project
On 4/8/07, robin bajaj <[EMAIL PROTECTED]> wrote: Hi All, In my Struts 1.2.x webapp, I am getting some Patient records from backend using my PatientManager businessObject (which uses Hibernate) to send back a populated Patients List in the request scope. (Patient is my bean). I am feeding this patientsList to Displaytag table, to show the data in a table. Here's the code snippet for my jsp containing displaytag table. http://rafb.net/p/artIJr98.html Now, I want to sort this table based on the PatientID when I click on the PatientID column. I read in the Displaytag docs http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp where it mentions the following : If you want to allow the user to sort the data as it is coming back, then you need to just do two things, make sure that the data returned from your property implements the Comparable interface (if it doesn't natively - use the decorator pattern as shown a couple of examples ago), and then set the attribute sortable="true" on the columns that you want to be able to sort by. Following the above suggestion, I changed my Patient class to implement Comparable interface and implemented the following compareTo method (as following) http://rafb.net/p/t0CR4Q98.html Then I re-build my app and restart it on the server, the displaytag table shows up fine. But when I click on the first column PtId, it doesn't sort the table. I just get the Http404 error page. Am I missing something ? Try setting the requestURI attribute of the table itself? --tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] problem with displaytag column sorting in struts 1.2 web project
Hi All, In my Struts 1.2.x webapp, I am getting some Patient records from backend using my PatientManager businessObject (which uses Hibernate) to send back a populated Patients List in the request scope. (Patient is my bean). I am feeding this patientsList to Displaytag table, to show the data in a table. Here's the code snippet for my jsp containing displaytag table. http://rafb.net/p/artIJr98.html Now, I want to sort this table based on the PatientID when I click on the PatientID column. I read in the Displaytag docs http://displaytag.homeip.net/displaytag-examples-1.1/example-sorting.jsp where it mentions the following : If you want to allow the user to sort the data as it is coming back, then you need to just do two things, make sure that the data returned from your property implements the Comparable interface (if it doesn't natively - use the decorator pattern as shown a couple of examples ago), and then set the attribute sortable="true" on the columns that you want to be able to sort by. Following the above suggestion, I changed my Patient class to implement Comparable interface and implemented the following compareTo method (as following) http://rafb.net/p/t0CR4Q98.html Then I re-build my app and restart it on the server, the displaytag table shows up fine. But when I click on the first column PtId, it doesn't sort the table. I just get the Http404 error page. Am I missing something ? Please help, thanks in advance, robin. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]