adrianospinoso
Jun 11th, 2008, 05:02 AM
Hello to all.
I'm a problem with a controller that extends SimpleFormController.
I have a jsp with a form with some input fields. With this form view is associated a command object that I create in formBackingObject method:
protected Object formBackingObject(HttpServletRequest request)
throws Exception {
logger.debug("entering formBackingObject method...");
StatisticsSearch searchcriteria = new StatisticsSearch();
return searchcriteria;
}
I fill my form with the data and then click the on submit button.
In the onSubmit method a performe a query with the data of command object and then display results in a jsp page with a table.
The problem is that if my query take long time to retrieve data from DB I see that the onSubmit method is called again and I'm sure than no one neither clicked again the submit button or refresh the page.
when this happens the success view page is not displayed and I see only a blank page.
My onSubmit method is:
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
log.debug("'Controller' --> entering method 'onSubmit'");
//Ricavo il command object
StatisticsSearch searchcriteria = (StatisticsSearch)command;
// Controllo lo stato del link
boolean isLinkAvailable = false;
do {
isLinkAvailable = statisticsManager.testLink();
}while (!isLinkAvailable);
//Short groupBy = searchcriteria.getGroupBy();
Short groupBy = -1;
searchcriteria.setCustId(-1l);
searchcriteria.setFromdate(new Date(1213027234000l));
searchcriteria.setTodate(new Date(1213113634000l));
if(groupBy == null || groupBy.shortValue() == Constants.NO_GROUPING){
logger.info("user requested statistics details");
List<StatisticsDetailsCompared> details = null;
try {
details = statisticsManager.getStatistcsDetails(searchcriter ia);
} catch (RuntimeException e) {
logger.error(e);
}
logger.debug("Details list size: " + details.size());
request.getSession().setAttribute("details", details);
return new ModelAndView(getSuccessView());
}else{
return new ModelAndView(new RedirectView("home.html"));
}
}
Someone can help me?
Thanks in advance
I'm a problem with a controller that extends SimpleFormController.
I have a jsp with a form with some input fields. With this form view is associated a command object that I create in formBackingObject method:
protected Object formBackingObject(HttpServletRequest request)
throws Exception {
logger.debug("entering formBackingObject method...");
StatisticsSearch searchcriteria = new StatisticsSearch();
return searchcriteria;
}
I fill my form with the data and then click the on submit button.
In the onSubmit method a performe a query with the data of command object and then display results in a jsp page with a table.
The problem is that if my query take long time to retrieve data from DB I see that the onSubmit method is called again and I'm sure than no one neither clicked again the submit button or refresh the page.
when this happens the success view page is not displayed and I see only a blank page.
My onSubmit method is:
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
log.debug("'Controller' --> entering method 'onSubmit'");
//Ricavo il command object
StatisticsSearch searchcriteria = (StatisticsSearch)command;
// Controllo lo stato del link
boolean isLinkAvailable = false;
do {
isLinkAvailable = statisticsManager.testLink();
}while (!isLinkAvailable);
//Short groupBy = searchcriteria.getGroupBy();
Short groupBy = -1;
searchcriteria.setCustId(-1l);
searchcriteria.setFromdate(new Date(1213027234000l));
searchcriteria.setTodate(new Date(1213113634000l));
if(groupBy == null || groupBy.shortValue() == Constants.NO_GROUPING){
logger.info("user requested statistics details");
List<StatisticsDetailsCompared> details = null;
try {
details = statisticsManager.getStatistcsDetails(searchcriter ia);
} catch (RuntimeException e) {
logger.error(e);
}
logger.debug("Details list size: " + details.size());
request.getSession().setAttribute("details", details);
return new ModelAndView(getSuccessView());
}else{
return new ModelAndView(new RedirectView("home.html"));
}
}
Someone can help me?
Thanks in advance