Foros de discusión
Display Dynamic Message along with Session Success Message
Ramakrishnan Sinduja, modificado hace 7 años.
Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Hi,
I want to display message as"Email has been successfully sent to X recipients" and the X is the email count.Could anybody tell me how to achieve this.
Regards,
Sindhu R
I want to display message as"Email has been successfully sent to X recipients" and the X is the email count.Could anybody tell me how to achieve this.
Regards,
Sindhu R
Pankaj Kathiriya, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
You can use LanguageUtil utility class to achieve this.
e.g.
language-key=Email has been successfully sent to {0} recipients
Here, placeholdervalue will be custom count.
e.g.
language-key=Email has been successfully sent to {0} recipients
LanguageUtil.format(locale, "language-key", placeholdervalue)
Here, placeholdervalue will be custom count.
Ramakrishnan Sinduja, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Hi Pankaj,
Thanks for your response.
Just correct me If I am wrong, the below line needs to be set in action class and language-key=Email has been successfully sent to {0} recipients has to set in Language.properties is it???
LanguageUtil.format(locale, "language-key", placeholdervalue).
Appreciate your response.
Regards,
Sindhu R
Thanks for your response.
Just correct me If I am wrong, the below line needs to be set in action class and language-key=Email has been successfully sent to {0} recipients has to set in Language.properties is it???
LanguageUtil.format(locale, "language-key", placeholdervalue).
Appreciate your response.
Regards,
Sindhu R
Gaurav Jain, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
Junior Member Mensajes: 85 Fecha de incorporación: 12/07/16 Mensajes recientes
Hi Mrs Sindhu,
This line is to be set into jsp file where you want to display dynamic message.
Regards,
Gaurav
Mrs Sindhu:
LanguageUtil.format(locale, "language-key", placeholdervalue).
This line is to be set into jsp file where you want to display dynamic message.
Regards,
Gaurav
Mrs Sindhu, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Thank You
Mrs Sindhu, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Hi Gaurav,
As mentioned I have set the LanguageUtil.format(locale, "mailSendKey", Message); in my JSP page where I want to display. But I am unable to see the expected message .
Please advice.
Regards,
Sindhu R
As mentioned I have set the LanguageUtil.format(locale, "mailSendKey", Message); in my JSP page where I want to display. But I am unable to see the expected message .
Please advice.
Regards,
Sindhu R
Gaurav Jain, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
Junior Member Mensajes: 85 Fecha de incorporación: 12/07/16 Mensajes recientes
Hi Mrs Sindhu,
This should work, you must be missing something. But if not, you can try this also in you jsp:
Here mailCount is that dynamic value you want to display as part of message.
One more thing, do not forget to set this key into session message from your controller class as:
Regards,
Gaurav
This should work, you must be missing something. But if not, you can try this also in you jsp:
<liferay-ui:success key="mailSendKey" message="<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", mailCount) %>" />
Here mailCount is that dynamic value you want to display as part of message.
One more thing, do not forget to set this key into session message from your controller class as:
SessionMessages.add(actionRequest, "mailSendKey");
Regards,
Gaurav
Mrs Raghavan, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Ok, thanks Gaurav.
I will try as you have mentioned.
I will try as you have mentioned.
Mrs Raghavan, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Hi Gaurav,
I am able to achieve this by
<liferay-ui:success key="mailSendKey" message='<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", 3) %>' />
but here I have hard coded the mail count as 3, and I have stored the mailcount value in session variable in controller class.
If I change like below its not working, Please advice.
Integer intEmailCount = (Integer) session.getAttribute("EmailCount");
<%if(intEmailCount!=null){
<liferay-ui:success key="mailSendKey" message='<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", 3) %>' />
<%}%>
I am able to achieve this by
<liferay-ui:success key="mailSendKey" message='<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", 3) %>' />
but here I have hard coded the mail count as 3, and I have stored the mailcount value in session variable in controller class.
If I change like below its not working, Please advice.
Integer intEmailCount = (Integer) session.getAttribute("EmailCount");
<%if(intEmailCount!=null){
<liferay-ui:success key="mailSendKey" message='<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", 3) %>' />
<%}%>
Mrs Raghavan, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Hi Gaurav,
I have managed to solve the issue and its working as expected.I have used your below syntax.
<liferay-ui:success key="mailSendKey" message='<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", mailCount) %>' />
And mailCount , I am setting in controller class.Work Perfect.
Thanks a lot for timely help.
Regards,
Sindhu R
I have managed to solve the issue and its working as expected.I have used your below syntax.
<liferay-ui:success key="mailSendKey" message='<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", mailCount) %>' />
And mailCount , I am setting in controller class.Work Perfect.
Thanks a lot for timely help.
Regards,
Sindhu R
Gaurav Jain, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
Junior Member Mensajes: 85 Fecha de incorporación: 12/07/16 Mensajes recientes
Hi Mrs Raghavan,
One more thing I would like to let you know that you really do not need to hard code any string in success message as exemplary shown by me in:
Instead create a key in language.properties file as:
And use it in jsp as:
Note: In this case pageContext has been used instead of locale
Regards,
Gaurav
One more thing I would like to let you know that you really do not need to hard code any string in success message as exemplary shown by me in:
<liferay-ui:success key="mailSendKey" message="<%=LanguageUtil.format(locale, "Email has been successfully sent to {0} recipients", mailCount) %>" />
Instead create a key in language.properties file as:
mailSendKey=Email has been successfully sent to {0} recipients
And use it in jsp as:
<liferay-ui:success key="mailSendKey" message="<%=LanguageUtil.format(pageContext, "mailSendKey", mailCount) %>" />
Note: In this case pageContext has been used instead of locale
Regards,
Gaurav
Mrs Raghavan, modificado hace 7 años.
RE: Display Dynamic Message along with Session Success Message
New Member Mensajes: 19 Fecha de incorporación: 28/07/16 Mensajes recientes
Hi Gaurav,
Ok Noted, I will try to implement the below changes .
Thanks for your response.
Regards,
Mrs.Raghavan.
Ok Noted, I will try to implement the below changes .
Thanks for your response.
Regards,
Mrs.Raghavan.