File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes bean:message and linebreaks [Solved] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:message and linebreaks [Solved]" Watch "bean:message and linebreaks [Solved]" New topic

bean:message and linebreaks [Solved]

P-A Rosenberg

Joined: Sep 22, 2005
Posts: 15
Is there a way to include a linebreak within a msg resource item and have it displayed as a linebreak when displaying the message with the bean:message tag?

I would like to do this:
my.resource=A line with <br/> a linebreak.

And have it displayed on my JSP page as:
"A line with
a linebreak."
when using <bean:message key="my.resource"/>

The question also applies when reading a string from a database, can it contain linebreaks that will be interpreted as a linebreak when displayed with a struts tag?


Hi again.
This problem have been solved by reading the documentation... doh... :roll:

bean:write has a filter attribute that can set to false to disable the feature that rewrites any "characters that are sensitive in HTML". This way a <br/> tag can be placed in e.g. a database and it will be interpreted as a HTML tagg when rendered.

bean:message seems to work OK with linebreaks in resources located in resource file. I guess I did something else wrong when trying this last time.
[ November 24, 2005: Message edited by: P-A Rosenberg ]
I agree. Here's the link:
subject: bean:message and linebreaks [Solved]
It's not a secret anymore!