File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Prevent Struts2 escaping html in labels? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Prevent Struts2 escaping html in labels?" Watch "Prevent Struts2 escaping html in labels?" New topic
Author

Prevent Struts2 escaping html in labels?

Xolani Nkosi
Ranch Hand

Joined: Apr 29, 2009
Posts: 32
Hi all.

I'd like to use a jquery-ui icon on a struts2 button to add a bit of visual flair to an app. The code in the jsp looks something like:

And my application.properties text is:

This almost does what I'd like, except somewhere along the line the html in the message has been escaped. The html generated looks like:

Any ideas what is doing the escaping and how to stop it? Or if anyone has done what I'm attempting and has a better way of doing it (preferably that will allow adding icons to buttons to be made via application.properties changes only)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You might have to change the template or use normal CSS. The current "xhtml" theme templates (css_xhtml might be a little better, I know someone made some enhancements to it) aren't super-good at exposing ids/classes to CSS.

All that said I'd really recommend against putting markup stuff in resource files unless there's a *really* good reason to do so. Since the label field would be accessible using straight CSS I don't think this is one of the places where it'd be necessary.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Prevent Struts2 escaping html in labels?