use of com.demo.model.Team in project jSqlBox by drinkjava2.
the class TeamController method addTeamPage.
@RequestMapping(value = "/add", method = RequestMethod.GET)
public ModelAndView addTeamPage() {
ModelAndView modelAndView = new ModelAndView("add-team-form");
modelAndView.addObject("team", new Team());
return modelAndView;
}
use of com.demo.model.Team in project jSqlBox by drinkjava2.
the class TeamController method editTeamPage.
@RequestMapping(value = "/edit/{id}", method = RequestMethod.GET)
public ModelAndView editTeamPage(@PathVariable Integer id) {
ModelAndView modelAndView = new ModelAndView("edit-team-form");
Team team = teamService.getTeam(id);
modelAndView.addObject("team", team);
return modelAndView;
}
use of com.demo.model.Team in project jSqlBox by drinkjava2.
the class TeamController method listOfTeams.
@RequestMapping(value = "/list")
public ModelAndView listOfTeams() {
ModelAndView modelAndView = new ModelAndView("list-of-teams");
List<Team> teams = teamService.getTeams();
modelAndView.addObject("teams", teams);
return modelAndView;
}
use of com.demo.model.Team in project jSqlBox by drinkjava2.
the class Initializer method onStartup.
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(WebAppConfig.class);
servletContext.addListener(new ContextLoaderListener(ctx));
ctx.setServletContext(servletContext);
Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
// force refresh
ctx.refresh();
// SqlBoxContext.setGlobalAllowShowSql(true);
SqlBoxContext sqlCtx = ctx.getBean(SqlBoxContext.class);
SqlBoxContext.setGlobalSqlBoxContext(sqlCtx);
String[] ddls = sqlCtx.toDropAndCreateDDL(Team.class);
for (String ddl : ddls) sqlCtx.quiteExecute(ddl);
for (int i = 0; i < 5; i++) new Team().put("name", "Team" + i, "rating", i * 10).insert();
System.out.println("========== com.jsqlboxdemo.init.Initializer initialized=====");
}
Aggregations