【发布时间】:2015-09-03 18:25:27
【问题描述】:
有很多类似的问题,我已经看过了,但仍然无法弄清楚我的问题是什么。非常感谢您的帮助。 这是我的控制器:
@RestController
@RequestMapping(value = "/game")
public class YatzyController {
@Autowired
private Games games;
@RequestMapping(value = "/{DiceDTO}", method = RequestMethod.POST)
public GameState putGameState(@ModelAttribute("DiceDTO") DiceDTO diceDTO) {
return null;
}
这是我的 HTML:
<form method="post" enctype='application/json' action="/game">
<button type="button" onclick="rollDice()">Roll dice</button>
<div>
<input type="text" id="dice1" disabled>
<input type="checkbox" id="keepdice1" value="Keep">
</div>
<div>
<input type="text" id="dice2" disabled>
<input type="checkbox" id="keepdice2" value="Keep">
</div>
<input type="submit">
</form>
配置类:
@Configuration
public class YatzyConfiguration {
@Bean
public Games games(){
return new Games();
}
}
发布到 /game
【问题讨论】:
-
能否也提供您的 Spring Boot 配置类?另外,您发布的网址是什么?
-
@geoand 当然,等一下
标签: spring spring-boot