我是新手玩框架。在嘗試生成帶模板的html模板時,我收到了錯誤非法啓動簡單模式在線ticket.getTicketIds。花了一些時間試圖解決問題,但沒有好處。非法啓動簡單模式 - 玩框架
<tbody>
@for(ticket <- @obj.getPurchasedTickets()) {
@for((key,val) <- @obj.getTicketsCalculation()) {
@if(key.equals(ticket.getTicketId())) {
<tr>
<td class="desc">@ticket.getTicketName()<br></br>
@if(ticket.getTicketIds() != null && !ticket.getTicketIds().isEmpty()) {
@for(ticketid <- ticket.getTicketIds){
#@ticketid
}
}
</td>
<td class="unit">@ticket.getPrice()</td>
</tr>
}
}
}
</tbody>
以下的POJO用於獲取必要的值
public class PurchasedTicket {
private String ticketId; // represents the ticket's id
private String ticketName;
private Integer numberOfTickets;
private Double price;
private List<String> ticketIds; // list of tickets bought with this ticket
// setters and getters
}
public class Wrapper{
private Map ticketsCalculation;
private List<PurchasedTicket> purchasedTickets;
// setters and getters
}
在模板部分的OBJ表示爲對象包裝類
'ticket.getTicketIds'顯示了幾次。哪一個? – Rumid
@for中的一個(ticketid < - ticket.getTicketIds){@ ticketid } – user3673985
它們表示字符串值。 – user3673985