Spring 系列,第 3 部分

进入 Spring MVC

用 Spring MVC 轻松进行应用程序开发

返回文章

在打印这一页时,请选择 landscape 布局选项。

清单 4. LoginBankController 扩展 SimpleFormController
public class LoginBankController extends SimpleFormController {
   public LoginBankController(){
   }
   protected ModelAndView onSubmit(Object command) throws Exception{
      LoginCommand loginCommand = (LoginCommand) command;
      authenticationService.authenticate(loginCommand);
      AccountDetail accountdetail = accountServices.getAccountSummary(loginCommand.getUserId());
      return new ModelAndView(getSuccessView(),"accountdetail",accountdetail);
   }
   private AuthenticationService authenticationService;
   private AccountServices accountServices;
   public AccountServices getAccountServices() {
      return accountServices;
   }
   public void setAccountServices(AccountServices accountServices) {
      this.accountServices = accountServices;
   }
   public AuthenticationService getAuthenticationService() {
      return authenticationService;
   }
   public void setAuthenticationService(
         AuthenticationService authenticationService) {
      this.authenticationService = authenticationService;
   }
}

返回文章