Corrections on PlayerSettingsController and SearchController.
This commit is contained in:
+7
-4
@@ -60,7 +60,12 @@ public class PlayerSettingsController {
|
||||
private TranscodingService transcodingService;
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
protected String formBackingObject(HttpServletRequest request, Model model) throws Exception {
|
||||
protected String displayForm() throws Exception {
|
||||
return "playerSettings";
|
||||
}
|
||||
|
||||
@ModelAttribute
|
||||
protected void formBackingObject(HttpServletRequest request, Model model) throws Exception {
|
||||
|
||||
handleRequestParameters(request);
|
||||
List<Player> players = getPlayers(request);
|
||||
@@ -103,11 +108,10 @@ public class PlayerSettingsController {
|
||||
command.setAdmin(user.isAdminRole());
|
||||
|
||||
model.addAttribute("command",command);
|
||||
return "playerSettings";
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
protected String doSubmitAction(@ModelAttribute PlayerSettingsCommand command, Model model) throws Exception {
|
||||
protected String doSubmitAction(@ModelAttribute("command") PlayerSettingsCommand command, Model model) throws Exception {
|
||||
Player player = playerService.getPlayerById(command.getPlayerId());
|
||||
|
||||
player.setAutoControlEnabled(command.isAutoControlEnabled());
|
||||
@@ -121,7 +125,6 @@ public class PlayerSettingsController {
|
||||
transcodingService.setTranscodingsForPlayer(player, command.getActiveTranscodingIds());
|
||||
|
||||
command.setReloadNeeded(true);
|
||||
model.addAttribute("command",command);
|
||||
return "redirect:playerSettings.view";
|
||||
}
|
||||
|
||||
|
||||
+8
-4
@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindException;
|
||||
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;
|
||||
@@ -66,13 +67,17 @@ public class SearchController {
|
||||
private SearchService searchService;
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
protected String formBackingObject(HttpServletRequest request, Model model) throws Exception {
|
||||
model.addAttribute("command",new SearchCommand());
|
||||
protected String displayForm() throws Exception {
|
||||
return "search";
|
||||
}
|
||||
|
||||
@ModelAttribute
|
||||
protected void formBackingObject(HttpServletRequest request, Model model) throws Exception {
|
||||
model.addAttribute("command",new SearchCommand());
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
protected String onSubmit(HttpServletRequest request, HttpServletResponse response, SearchCommand command, Model model)
|
||||
protected String onSubmit(HttpServletRequest request, HttpServletResponse response,@ModelAttribute("command") SearchCommand command, Model model)
|
||||
throws Exception {
|
||||
|
||||
User user = securityService.getCurrentUser(request);
|
||||
@@ -101,7 +106,6 @@ public class SearchController {
|
||||
command.setPlayer(playerService.getPlayer(request, response));
|
||||
}
|
||||
|
||||
model.addAttribute("command",command);
|
||||
return "search";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user