PDA

View Full Version : OnSubmit never called


LostInSpace2011
Mar 16th, 2006, 08:15 AM
I implemented a subclass of SimpleFormController. For some reason the onSubmit method is never called. I can see the onBind method in my log, but onSubmit is never called. Yet for some reason I am being redirected to the successView.

I am almost certain I am making a very silly mistake, I just can't figure out what it is.


public class RulesController extends SimpleFormController
{
/** Creates a new instance of RulesController */
public RulesController()
{
logger.info("Constructing new RulesController");
}

protected void onBind(HttpServletRequest request, Object command)
{
logger.info("On Bind :"+command);
...
}
...
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception
{
logger.info("On Submit :"+command);
...
return new ModelAndView(getSuccessView());
}
...
protected Map referenceData(HttpServletRequest request)
{
logger.info("Retrieving referenced data from backend");
...
return dataMap;
}
}


The form view is rendered correctly, and the successview also appear correct, but onSubmit (which does the actual work for me) is never called. I am also not overrideing the handleRequest method.


2006-03-16 13:01:17,950 DEBUG [com.helveta.cie.civ.spring.RulesController] No errors -> processing submit

Any pointer would help me out a lot
alex

LostInSpace2011
Mar 16th, 2006, 08:34 AM
Problem solved!

My fault, I used wrong import for BindException, so this method did not override super class's one.

The follows :

import java.net.BindException;

replaced with :

import org.springframework.validation.BindException;


fixed the problem. Maybe an entry in the default implementation to update the log with a warning / message would be nice.