[jboss-user] [JBoss Seam] - Re: formattedText with dynamic content - escaping

appendix do-not-reply at jboss.com
Thu Nov 22 04:17:17 EST 2007

Hi Pete,

thank you for showing interest. 
I gave the whole situation a brief thought and came to the conclusion that a generic approach that transparently escapes rich text tokens in s:formattedText would be hard to implement, because the method would have to differentiate somehow between formatting rich text tokens and tokens that are simply in the text as characters, so I'm using a pretty simple, but working, approach right now.

I'm having a Seam managed Java Bean called "ste" (short for seam text escaper), which offers a method "esc(String s)" that escapes the rich text tokens using a Stringtokenizer. 
So in the message bundle I can escape certain properties, that could contain rich text tokens which needs to be escaped like that:

  | newGroupCreated.text=The new group '*#{ste.esc(group.name)} (#{ste.esc(group.nameShort)})*' was created successfully.

Now 'newGroupCreatet.text' can be used in <s:formattedText /> even if  'group.name' contains characters like underscore or slash without breaking the generated HTML.

If anyone is interested, I can post the code as well, but it's nothing spectacular. 

Best regards,


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107009#4107009

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107009

More information about the jboss-user mailing list