springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 13:02:36
216
我遇到了一个很奇怪的问题,我找不到原因。简单地说,当我试图在update.html中更新应用程序中以前给出的一些答案时,某些东西会为我的一个输入字段生成随机ID和随机名称值,因此这些特定的数据不会被发送到后端。
下面是我的update.html的控制器方法
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
这是我要发送到HTML的对象的类
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
问题类
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
我的答案类
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
我的更新HTML
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
最后,我的renderanswerform.js文件
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
在浏览器中检查ScaleQuestion输入时,我看到的不是正确的名称属性,而是以下内容。我在代码中没有提供任何id,并且name属性一开始就不应该包含“Question0.answers0”,只应该包含answers[0]。 启动应用程序时在HTML中使用ScaleQuestion(不正确)
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
RadioButton问题(正确):
@GetMapping("/update/{questionFormId}/{appUserId}")
public String updateAnswerFormCreatedByUser(@PathVariable long questionFormId, @PathVariable long appUserId, Model model) {
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " started");
try {
model.addAttribute("answerForm", answerFormService.createAnswerFormToUpdate(questionFormId, appUserId));
log.info("GET answer-form/update/" + questionFormId + "/" + appUserId + " finished");
return "answerform/update";
到目前为止我所尝试的内容:
我的猜测是js代码以前的某个状态发生了干扰(因为在此之前所有的输入字段都是在js中生成的),但我看不出是如何或在哪里生成的。
提前感谢您的帮助!
顺晟科技:
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11