How to display different flash.message in different style in GSP page

浪尽此生 提交于 2019-12-12 03:57:48

问题


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


回答1:


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)


来源:https://stackoverflow.com/questions/12813624/how-to-display-different-flash-message-in-different-style-in-gsp-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!