Home Replace text returned from messages.properties in gsp
Reply: 0

Replace text returned from messages.properties in gsp

user1021 Published in April 19, 2018, 10:01 am

I have a text in gsp as follows: <g:message code="${code}" locale="${locale}"/>

The problem is the message returned can contain characters such as & and when exporting this gsp to pdf, the following error occurs:

Caused by: org.xml.sax.SAXParseException; lineNumber: 396; columnNumber: 44; The entity name must immediately follow the '&' in the entity reference.
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)

This issue could be resolved if & could be replaced by &amp;

I have tried using g:encodeAs but that didn't help. I cannot change the & in messages.properties to &amp; or and.

Is it even possible to replace a text returned from messages.properties before rendering in gsp?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.440544 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO