一旦我添加了一些javascripts,例如:datepicker ......等,我的POST表单操作有些麻烦
请问好吗? 按照他的方式,Javascripts与控制器中的Result方法checkbox()无关.....我不知道为什么控制器和js脚本之间存在冲突!!!
1-查看模板代码(当我将Javascript放入注释时我的方法java代码中的结果复选框工作正常)
这是我的方法结果复选框()
public Result checkbox() {
String[] postAction = request().body().asFormUrlEncoded().get("action");
String action = postAction[0];
if (postAction == null || postAction.length == 0)
{return badRequest("Veuillez selectionner une Action Valide");}
else
{
String[] computers = request().body().asFormUrlEncoded().get("chkItems");
if (computers != null && ("PDF Report".equals(action) || "HTML Report".equals(action) || "XLS Report".equals(action) || "New Edit".equals(action) || "JsonList".equals(action)) )
{
String ids = ListUtils.mkString(computers, s -> "" + s, ";");
Logger.info("ids Selected are : "+ids);
switch (action)
{
case "PDF Report" : return GenerateReport(ids,"pdf");
case "XLS Report" : return GenerateReport(ids,"xls");
case "HTML Report" : return GenerateReport(ids,"html");
case "New Edit" : return EditNames(ids,"Edit From Action");
default : return ok("default switch : Action <<"+action+">> avec Parametres Error>>");
}
}
else if (computers == null && ("PDF Report".equals(action) || "HTML Report".equals(action) || "XLS Report".equals(action) || "New Edit".equals(action) || "JsonList".equals(action)) )
{
return ok("Cette Action necessite au moins un parametre d'entré");
}
else
{
switch (action)
{
case "Add New" : return Results.redirect(routes.Computers.create());
case "Send Simple Mail" : return SendSimpleEmail();
case "Send Complex Mail" : return SendComplexEmail();
case "Open IMG File" : return OpenIMGfile("./public/images/wall.jpg");
default : return ok("default switch : Action <<"+action+">> sans Parametres Error>>");
}
}
}}
@scripts = {
<script src="@routes.Assets.at("javascripts/computers/delete.js")"></script>
<script src="@routes.Assets.at("javascripts/computers/put.js")"></script>
<script src="@routes.Assets.at("javascripts/computers/dt_computers.js")"></script>
}
@main(用户,脚本){
}