I'm a beginner in programming.
No value is received from the controller.Even if I change the value from the controller, the result remains the same and the decision is not made, so I feel that the switch statement is out of touch with the controller, but I don't know what to do.Please let me know.
<tbody>
<trth:each="User:${userList}">
<td class="text-center">
<divth:switch="${User.plan}">
<pth:case="'plann'">Preparing</p>
</div>
<div th:case="'Save'">
<a href="'>Save</a>
</div>
<div th:case="'Submit'">
<a href=">Submit</a>
</div>
<div th:case="'Cancel'">
<a href=">Cancel</a>
</div>
<div th:case="*">
<a href="">Refer to </a>
</div>-->
</td>
<tbody>
package com.example.demo;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.announcement.RequestMapping;
@ Controller
public class test {
@RequestMapping(value="user")
public String User (Model Model) {
List<User>pro=new ArrayList<User>();
Mission P = new Mission();
Model.addAttribute("userList", P);
return "userList.html";
}
}
package com.example.demo;
public class User {
private String plan;
public User() {
This.plan="Submit";
}
public String getplan() {
return MissionSt;
}
public void setplan(String missionSt){
MissionSt = missionSt;
}
There are many mistakes, but the most incorrect thing is that Model.addAttribute()
is passing the Mission
object to Model.addAttribute()
instead of the list of users that ArrayList<User>
expects.
Model.addAttribute("userList", P);
At least the following:
Model.addAttribute("userList", pro);
However, even with this modification, pro
is an array with zero elements, so html does not display anything.At least one line of pro.add(...);
is required.
And just a quick look at it.
th:switch
tags not in parallel<tbody>
tag, <tr>
tag not closed<a href="'>
does not require a single quotationMission
and plan
are mixed upgetplan()
, setplan()
, but getPlan()
, setPlan()
List<User>pro=new ArrayList<User>();
). Why is the list of users pro
?Mission P=new Mission();
), usually with lowercase letters.and so on.
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
911 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.