messageViewer.scala.html
@(formData: Map[String, String] )
<!DOCTYPE html>
<html>
<head lang="sv">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Java Play - Scala Template</title>
</head>
<body>
@if(formData.get("nockOutRuleStatus1").equals("SUBMITTED") && formData.get("nockOutRuleStatus2").equals("APPROVED")){
//This statement should execute. But it is not executed.
<button type="button" class="btn btn-default btn-lg hide-element" id="openSuccessModalBtn" data-toggle="modal" data-target="#successModal">Success</button>
}
@if(formData.get("nockOutRuleStatus1").equals("REJECTED") || formData.get("nockOutRuleStatus2").equals("AUTO-REJECTED")){
<button type="button" class="btn btn-default btn-lg hide-element" id="openErrorModalBtn" data-toggle="modal" data-target="#errorModal">Error</button>
}
</body>
</html>
从我的Java控制器( messageCtrl.java ),我正在传递地图类型formData。
Map<String, String> formData = new HashMap<String, String>();
formData.put("nockOutRuleStatus1","SUBMITTED");
formData.put("nockOutRuleStatus2","APPROVED");
return ok(messageViewer.render(formData));
但是第一个IF
块中的语句未执行。