0

I have a controller which has an interface as proxy

@Controller
public class MyController implements IMyController{

    public FormBean getCommand(){
        return new FormBean();
    }

    public String onLoad(HttpServletRequest req,HttpServletResponse res){
    }
}

The interface as follows:

public interface IMyController {

    @ModelAttribute("formBean")
    FormBean getCommand();

    @RequestMapping("/onload.do")
    String onLoad(HttpServletRequest req,HttpServletResponse res);
}

Problem is, the getCommand() method doesn't get called anytime. I have also tried by moving the modelattribute annotation to the implementation class but to no avail.

Where am I going wrong?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Srini
  • 420
  • 1
  • 5
  • 17

1 Answers1

0

Try this

public String onLoad(@ModelAttribute("formBean") FormBean form, HttpServletRequest req,HttpServletResponse res) {       
   return "pageName";
}
java_dude
  • 4,038
  • 9
  • 36
  • 61