Skip to content
Snippets Groups Projects

Resolve "As a user I want to see a list of all available towns with trails so I can plan where to go"

Files

 
package Team5.SmartTowns.Towns;
 
 
import org.springframework.stereotype.Controller;
 
import org.springframework.web.bind.annotation.GetMapping;
 
import org.springframework.web.servlet.ModelAndView;
 
 
import java.util.List;
 
 
@Controller
 
public class TownController {
 
 
@GetMapping("/home")
 
public ModelAndView getTownList(){
 
ModelAndView modelAndView = new ModelAndView("Towns/home/homePage");
 
TownStorage townsCurrent= new TownStorage().getInstance();
 
List<Towns> towns = townsCurrent.getTownList();
 
modelAndView.addObject("towns",towns);
 
return modelAndView;
 
 
}
 
}
Loading