チェックボックスの "checked"値と一致させようとしているコントローラからのビュー(htmlページ)のListを操作しています。Scala @関数/ HTMLドキュメントの言語 - forループ、if文など
モデルから選択したチェックボックスの値(List A)を取得し、コントローラで取得してビューに送信します。また、モデルからチェックボックスの選択/オプション/値(リストB)を取得します。したがって、ページを表示すると、リストBを循環し、リストAを循環して一致するものがあるかどうかを確認します。一致した場合はチェックボックスを表示し、一致しない場合はチェックボックスの値を表示します。ここで
はスカラです:
@(profileForm: Form[Application.ProfileRegister], servicesList: java.util.List[Service], profile: Profile, servicesSelected: java.util.List[String])
@main(null) {
...
<label class="title">Services Provided:<span class="required">*</span></label>
<div class="column column1">
@for(service <- servicesList) {
@for(checkService <- servicesSelected) {
@if(checkService.equals(service.name)) {
<label><input type="checkbox" checked class="selectServices" name="selectServices" id="selectServices" [email protected]><span>@service.name</span></label>
} else {
<label><input type="checkbox" class="selectServices" name="selectServices" id="selectServices" [email protected]><span>@service.name</span></label>
}
}
}
</div>
...
}
これは、チェックボックスの値を複製しているが、それはまたチェックした値で動作します。これは、ここに表示されます。
はこの正しいScalaのですか?
私の他の質問は、ビュー(html)内で使用できるScala @言語に関する文書はどこにありますか?私は検索しましたが、私が探しているものを見つけることはできません。これらのステートメント内の変数やHTMLだけを使用できますか?
私は助けてくれてありがとう!