I have to display different messages using flash.message, some of them have to be in different color, So How to distinguish the flash.message and display them in different color in GSP
Asked
Active
Viewed 3,250 times
1
-
3How about using of different variables in flash scope? E.g. flash.errorMessage, flash.successMessage, etc. – Sergei Shushkevich Oct 10 '12 at 07:04
1 Answers
4
the view page code to view error and suces msg in different style
<g:if test="${flash.message}">
<div class="message" role="status" style="font-size: medium;color: green;">${flash.message}</div>
</g:if>
<g:if test="${flash.warning}">
<div class="message_error" style="font-size: medium;color: red;">${flash.warning}</div>
</g:if>
the controller code to call respective label if scues:
flash.message = message(code: 'Applied Successfully', args: [message(code: 'hrIrRegistration.label', default: 'HrIrRegistration'), hrIrAplcJobAppldLkInstance.id])
redirect(controller: "hrIrRegistration", action: "showVcnyForApplcnt", id: params.hrIrVcncyIdHrIrVcncy.id)
if error:
flash.warning = message(code: 'You have already Applied in this vacancy', args: [message(code: 'hrIrRegistration.label', default: 'HrIrRegistration'), hrIrAplcJobAppldLkInstance.id])
redirect(controller: "hrIrRegistration", action: "showVcnyForApplcnt", id: params.hrIrVcncyIdHrIrVcncy.id)

Asif Mahamud
- 583
- 2
- 10