0
私は自分のアプリケーションをThymeleafに移植しています。リストのオブジェクトからフォームを作成する際に問題があります。フォームの選択とタイムリーフ
私はList<Plate> plates
を持っていると私のReservation
はPlate
フィールドを持っているので、それは(プレーンなJSPで働いていた)本当に基本的な選択の関連
だ私は」コントローラからこのフォーム
<form th:with="reservationUrl=(${price != null} ? '/book/confirm' : '/book/new')"
th:action="@{${reservationUrl}}" method="POST"
class="form-signin" th:object="${reservation}"
id="form-signin">
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="plate"
th:text="#{reservation.plate }">Targa</label>
<div class="col-sm-4 input-group">
<select th:type="*{plate}" class="form-control">
<option th:each="p : ${plates}"
th:value="${p.plateId}" th:text="${p.plateNumber}">Opzione</option>
</select>
</div>
// rest of the form
を持っていますmはこれがプレート
でこの例外にException evaluating SpringEL expression: "p.plateId" (reservation:67)] with root cause
Property or field 'plateId' cannot be found on object of type 'org.thymeleaf.util.EvaluationUtil$MapEntry' - maybe not public?
を取得します
@Entity
public class Plate {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long plateId;
private String plateNumber;
private String plateName;
@ManyToOne
@JoinColumn(name="userId")
@JsonBackReference(value="plates-user-reference")
private User user;
private boolean favourite;
@JsonIgnore
private boolean enabled;
//standard getters and setters
'$ {plates} 'とは何ですか?投稿してくださいPlate item class – StanislavL
Plate、thanks – besmart
$ {plates}はリストであり地図ではありませんか? – Metroids