Announcement Announcement Module
No announcement yet.
Design Help : Sorting, Pagination and SearchModification Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Design Help : Sorting, Pagination and SearchModification

    Hi All,

    My requirements are as follows :-
    1. User fills a search form and makes a search
    2. On next page- say searchResultsPage I show him the results along with an option to modify his search.. so I need to remember the previous selected options..
    3. also the search results on the searchResultsPage need to paginated and customizable ( number of results on a page, sorting order).. since my results are not in the tabular form.. I ruled out the display library option and thinking of using a form to pass these parameters..

    How should I design it ? The main problems that I am facing are :
    1. Remembering the old selections : I checked the technique of returning showForm() in which same view is generated again.. but I need different view and still want to remember the search criterias..

    2. I am having two different forms: first - old search (available for modifications) form and customizing search results ( done by onSelect of the options in a drop-down and submitting the form with customization criteria)
    should I combine these two forms : initially hiding all the customization parameters and then displaying them so to the user it looks like two different things but actually the same form is being submitted.. ?

    3. Should I actually use simpleform controller or something else(may be BaseCommandComtroller on first page(search form) and then SimpleFormController on next page(searchResultsPage) ?

    Thanx in Advance!

  • #2
    First Attempt

    I tried a lot but couldn't figure out a way to pass the data submitted in form on search page to the searchResults Page form so here is how I am doing this..

    servlet.xml :
    <bean name="/search" class="com.hestia.controllers.SearchController" parent="baseController">
    		<property name="commandName" value="simpleSearchBean"/>
    		<property name="commandClass" value=""/>
    		<property name="formView"><value>search</value></property>
    		<property name="successView"><value>searchResults</value></property>
        <bean name="/searchResults" class="com.hestia.controllers.SearchResultsController" parent="baseController">
          <property name="commandName" value="simpleSearchBean"/>
          <property name="commandClass" value=""/>
          <property name="formView"><value>searchResults</value></property>
          <property name="successView"><value>searchResults</value></property>
    In SearchController :

    	protected ModelAndView onSubmit(
    			HttpServletRequest request,	HttpServletResponse response, Object command,	BindException errors)
    			throws Exception {
    		SimpleSearchBean searchCriteria = (SimpleSearchBean)command;
            List<Property> results = propertyManager.simpleSearch(searchCriteria);
    		ModelAndView mav = super.onSubmit(request,response,command, errors);
    		mav.addObject("results", results);
    		return mav;
    and in the form on results page I gave action as "searchResults"

    Now I am able to get the searchResults and commandBean both on next page but the only problem is that though the radio Buttons are automatically bounded(I named commandBean same for both forms) but drop-downs are not bounded and I am planning to use javascript to do that.. All this looks like a really bad way of doing things..

    Can anyone suggest me a better way of doing things..