package com.sybit.education.taschengeldboerse.controller;


import com.sybit.education.taschengeldboerse.domain.Schueler;
import com.sybit.education.taschengeldboerse.service.UserService;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;



/**
 * Handles requests for the application home page.
 */
@Controller
public class AnbieterController {

    private static final Logger logger = LoggerFactory.getLogger(AnbieterController.class);

    
    @Autowired
    private UserService userService;
   
    /**
    * Simply selects the home view to render by returning its name.
    *
    * @param request needed to get the referring url
    * @return the logical view to be returned
    */
   @RequestMapping(value = "/registrieren/anbieter", method = RequestMethod.GET)
   public String registrierenFormular( final HttpServletRequest request) {
     
      return "registrieren-anbieter";
   }
   
    /**
     * Speichere neuen Anbieter.
     *
     * @param anbieter
     * @return the logical view to be returned
     */
    @RequestMapping(value = "/registrieren/anbieter", method = RequestMethod.POST)
    public ModelAndView saveForm(@ModelAttribute("anbieter") Schueler anbieter) {
        
        anbieter = userService.saveSchueler(anbieter);
        
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("anbieter", anbieter);

        modelAndView.setViewName("registrieren-anbieter");

        return modelAndView;
    }
}
@@ -53,16 +53,78 @@
 ller;%0A%0A%0A
+import com.sybit.education.taschengeldboerse.domain.Anbieter;%0A
 import c
@@ -1189,16 +1189,393 @@
 %0A    */%0A
+   /*@RequestMapping(value = %22/anbieter/schueler%22, method = RequestMethod.GET)%0A   public String home( final HttpServletRequest request) %7B%0A     %0A      return %22registrieren-anbieter%22;%0A   %7D*/%0A   %0A       /**%0A     * Lade das Formular f%C3%BCr die Anlage eines Sch%C3%BClers.%0A     *%0A     * @param request needed to get the referring url%0A     * @return the logical view to be returned%0A     */%0A 
    @Requ
@@ -1650,29 +1650,36 @@
 GET)%0A   
+ 
 public 
-String
+ModelAndView
  registr
@@ -1692,17 +1692,16 @@
 ormular(
- 
 final Ht
@@ -1728,35 +1728,167 @@
 uest) %7B%0A
+%0A 
      
-%0A      return 
+  ModelAndView modelAndView = new ModelAndView();%0A        modelAndView.addObject(%22anbieter%22, new Schueler());%0A%0A        modelAndView.setViewName(
 %22registr
@@ -1898,26 +1898,58 @@
 en-anbieter%22
+)
 ;%0A
+%0A        return modelAndView;%0A 
    %7D%0A   %0A   
@@ -2215,22 +2215,22 @@
 ieter%22) 
-Schuel
+Anbiet
 er anbie
@@ -2280,22 +2280,22 @@
 ice.save
-Schuel
+Anbiet
 er(anbie

Fix Anbieter anmelden