String[] computers = request().body().asFormUrlEncoded().get("computercode"); JsonNode json = request().body().asJson();response().setContentType("text/json");I added to my code this but this is not working yet:response().setContentType("text/json");
Igmar,
What are you suggesting me to do ? technically
//Controller
@BodyParser.Of(BodyParser.Json.class)
public Result checkbox()
{
String[] postAction = request().body().asFormUrlEncoded().get("action");
String action = postAction[0];
String[] computers = request().body().asFormUrlEncoded().get("computercode");
response().setContentType("application/json");
//response().setContentType("text/json");
JsonNode json = request().body().asJson();
String ids = ListUtils.mkString(computers, s -> "" + s, ";");
Logger.info("This is working fine : ids Selected are : "+ids);
Logger.info("This returns NULL");
return ok("Json : "+json);
}<form method="POST" action="/ComputersCustomActions">
<figure>
<button class="myBtn" type="submit" name="action" value="JsonList" formtarget="_blank"
style="background: url('@routes.Assets.at("images/toolbars/json.png")') ;">
</button>
<figcaption>Json
<br>BindRequest
</figcaption>
</figure>
</form>
POST /ComputersCustomActions controllers.HomeController.checkbox()