views:

709

answers:

0

Hi,

I'm developing a portlet by using Spring. In one of my JSPs I have a form where user can input search parameters ans submit. Both formView and successView is configured to be the same JSP page. In that page, I have a displayTag to render the result. Everything is ok except pagination of the list.My controller(SimpleFormController) has a validator to check if all the search parameters are entered by the user.

The problem is when pages are clicked nothing is displayed as a result. And the validator is called and prompts that the required parameters should be field and are not available.

In another section where I'm using an implementation of Controller I'm not having this problem and pagination is working perfectly.

So, I don't know why in my SimpleFormController when the view is returned displayTag can not get hold of search parameters already submitted. As a result, It will not submit the parameters for the link of subsequent pagination nubers.

Mycontroller

public class ReportCreator extends SimpleFormController {

private OnlineSupportUtil ouUtill;


public void setOuUtill(OnlineSupportUtil ouUtill) {
 this.ouUtill = ouUtill;
}


@Override
protected void initBinder(PortletRequest request,
  PortletRequestDataBinder binder) throws Exception {

    binder.registerCustomEditor(Date.class, "fromDate", new DateTypeEditor());
    binder.registerCustomEditor(Date.class, "toDate", new DateTypeEditor());

}




@Override
protected void onSubmitAction(ActionRequest request,
  ActionResponse response, Object command, BindException errors)throws Exception {

 SearchRequestTOObject obj = (SearchRequestTOObject)command;
 List requests = ouUtill.getRCRequests(obj.getDbid(), obj.getFromDate(), obj.getToDate());
 request.setAttribute("requests", requests);

}

@Override
protected ModelAndView onSubmitRender(RenderRequest request,
  RenderResponse response, Object command, BindException errors)throws Exception {



return new ModelAndView(getSuccessView(),"searchObject",new SearchRequestTOObject());
}

}

My JSP

    <form:form name="frm" commandName="searchObject" method="post" action="${formAction}" onsubmit="Submit();">
 <form:errors path="*"  cssClass="portlet-msg-error"/>
 <table width="100%" cellspacing="3">
  <tr>
   <td>
    id :
   </td>
   <td>
    <form:input path="dbid" />
   </td>
   <td>
     from :&nbsp;
   </td>
   <td>
    <liferay:input-date
              calendarImage=""
                 formName="frm"

                 dayParam="fromDay"
                 monthParam="fromMonth"
                 yearParam="fromYear"

                 dayValue="<%=Integer.parseInt(fromDay)%>"
                 monthValue="<%=Integer.parseInt(fromMonth)%>"
                 yearValue="<%=Integer.parseInt(fromYear)%>"

                 yearRangeStart="<%=yearPivot-5%>"
                 yearRangeEnd="<%=yearPivot+5%>"

                 firstDayOfWeek="6"

        locale="<%=locale.toString()%>"
                /> 
                <form:hidden path="fromDate" />
   </td>
   <td>
      to  :&nbsp;
   </td> 
   <td>
    <liferay:input-date
                  calendarImage=""
                  formName="frm"

                  dayParam="toDay"
                  monthParam="toMonth"
                  yearParam="toYear"

                  dayValue="<%=Integer.parseInt(toDay)%>"
                  monthValue="<%=Integer.parseInt(toMonth)%>"
                  yearValue="<%=Integer.parseInt(toYear)%>"

                  yearRangeStart="<%=yearPivot-5%>"
                  yearRangeEnd="<%=yearPivot+5%>"

                  firstDayOfWeek="6"

                  locale="<%=locale.toString()%>"
                  />
                  <form:hidden path="toDate" />
   </td>
  </tr>
  <tr>
   <td colspan="">
    <input type="submit" value="search"/>
   </td> 
  </tr>
 </table>   
</form:form>
<br>

<br>
<display:table name="requests" pagesize="1" id="row" class="mainList" >
 <display:column title="requestNo">
  <a href="<portlet:renderURL><portlet:param name="action" value="reportResult"/>
     <portlet:param name="rcRequestId"> 
       <jsp:attribute name="value"><c:out value="${row.ID}"/></jsp:attribute>
     </portlet:param>
    </portlet:renderURL>

  "><c:out value="${row.ID}"/></a>   
 </display:column>
 <display:column title="date">
  <oo:MyDate value="${row.requestDate}" />
 </display:column>
 <display:column title="sys">
  <c:out value="${row.productName}"/>
 </display:column>
</display:table>

Please help

Regards