====== List Out All Request Header ====== //in a controller def showAllHeaders(){ StringBuilder sb = new StringBuilder() request.headerNames.each{ sb.append(it).append(": ").append(request.getHeader(it)) .append("
") } render(sb.toString()) }
====== Showing Message, Error Message, Additional Error Messages in GSP Using Flash ====== Inside a method in a controller you do: flash.message = "The request ${camsRequest.getRequestReference()} has been released." //or, and flash.error = "Internal Error. Unable to release this request. If this problem persist, please contact the technical support." //or, and List errorMessages = [] errorMessages.add("First additional error") errorMessages.add("Second additional error") flash.errorMessages = errorMessages Inside a GSP view, you do:
${flash.message}
${flash.error}
  • ${errorMsg}
<% flash.message = null flash.error = null flash.errorMessages = null %>
Note that we added ''flash.message = null'', ''flash.error = null'', and ''flash.errorMessages = null'' to make sure those field are cleaned up. We do this because I something notice that these values in ''flash'' are not being clean after a response.