Aw: RE: Struts7: looking for constant to set escapeHtml=false
Ute Kaiser <[email protected]> Mon, 24 Mar 2025 19:04:22 +0000
| Newsgroups | gmane.comp.jakarta.struts.user |
|---|---|
| Message-ID | <trinity-7c7a17a2-11bf-42ef-9e00-5c22d977f7c9-1742843062088@trinity-msg-rest-webde-webde-live-58ddd584d4-s7gtb> |
Thx Lukasz and Nate. I created MypropertyTag.java extending PropertyTag.java with my own method setEscapeHtml but it was not called when the attribute escateHTML was not set in jsp. So I decided to go with Nate and to add the attribute in jsp. Yet, MypropertyTag helped me with another problem: to call locale-specific getter-methods of my bean. (This was done in my legacy Struts1 application by extending org.apache.struts.taglib.bean.WriteTag; I had to replace that.) Best regards Ute > Gesendet: Montag, 24. März 2025 um 10:23 > Von: "Nate Kerkhofs" <[email protected]> > An: "Struts Users Mailing List" <[email protected]> > Betreff: RE: Struts7: looking for constant to set escapeHtml=false > > <html><head></head><body>Hi Łukasz, > > I might be mistaken, but a custom tag using s:component would probably lead to having to replace most if not all affected s:property tags in the project. > > At that point, you might as well add the escapeHtml attribute to every s:property, because just replacing the s:property tags is probably going to be roughly the same amount as work as adding this attribute, and that's not accounting for writing the custom component. > > I'm not familiar with the internal logic of Struts, but could Ute maybe create a custom struts-tags.tld file which defines a custom property tag using a NoEscapeHtmlPropertyTag tag-class that sets the escapeHtml property to false by default? It appears that all of the relevant classes are defined as public, so in theory this might work. > > Regards, > > Nate