Commons Lang 2.0+ contains a StringEscapeUtils which has an escapeHtml and unescapeHtml that handle the &'s etc. I can look to adding these to the String Taglib as it depends on Lang anyway, is easy to code and is in need of an update to fit Lang 2.0.
Still waiting for JSP 2.0 to be a bit more out there before trying to decide what future String Taglib really has for me. Hen On Mon, 26 Jan 2004, Martin van Dijken wrote: > Hey Jim and Dan, > > The URLDecoder.decode method decodes a URLEncoding. This is the encoding > browsers do when you type for instance a spacechar in the location bar, > the browser replaces it with %20. This is definitely not the same thing > as HTML encoding in which you would replace the char & by &. > URLDecoding is definitely not a solution for your current issue. I've > never found a generic solution, but that is not to say there isn't one. > > Concerning your page layout issues, I'd definitely advise you to take a > look at Tiles. It works very well with struts as a plugin, but as I > understand it can function standalone as well. > > http://jakarta.apache.org/struts/userGuide/dev_tiles.html > > Good luck! > > Martin van Dijken > > > -----Original Message----- > > From: James Watkin [mailto:[EMAIL PROTECTED] > > Sent: zaterdag 24 januari 2004 2:01 > > To: Tag Libraries Users List > > Subject: RE: Tag to Unescape an HTML String? > > > > > > A little while ago I tried the Apache Jakarta String TagLib > > <str:decodeUrl>. It gave me the following error: URLDecoder: > > Illegal hex > > characters in escape (%) pattern - For input string: "&a". As > > you suggest, > > maybe the length of my body HTML String was too long to be > > passed as a param. > > > > - Jim > > > > At 04:45 PM 1/23/2004 -0800, you wrote: > > >java.net.URLDecoder.decode() will decode such a string. > > >You could create a simple tag that called the method > > >if you want. Be aware that some servers are unhappy with really big > > >URLs. > > >- Dan > > > > > > > -----Original Message----- > > > > From: James Watkin [mailto:[EMAIL PROTECTED] > > > > Sent: Friday, January 23, 2004 2:47 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: Tag to Unescape an HTML String? > > > > > > > > > > > > I have a question regarding the following problem and proposed > > > > solution: Within a JSP, what would be the most efficient way to > > > > unescape an HTML > > > > string? The Regexp tag library? I've managed to avoid > > writing regular > > > > expressions for a long time. > > > > > > > > Problem: > > > > I'm creating some reusable JSP templates that are chained > > together > > > > with <c:import>. I'm trying to solve the well known problem of > > > > having to create > > > > two new JSPs for every new page -- one for the new page body, > > > > the other to > > > > import the master page layout and pass the URL of the new > > > > page body JSP. > > > > > > > > Proposed Solution: > > > > Rather than pass the master page layout a URL for the body JSP, I > > > > can eliminate the body JSP by passing in the body as a > > String. If my > > > > master page layout is within the same container, then I can use > > > > <c:set> and not > > > > have to worry about unescaping the body String. However, I'd > > > > prefer (I > > > > think) to have the master page layout live outside the container, > > > > especially since the JSTL spec notes that foreign context > > > > access within the > > > > same container might not be supported by all containers. If > > > > the master page > > > > layout JSP is outside the container of the importing JSP, > > > > then the body > > > > HTML String has to be passed with <c:param>, which escapes > > > > the string. So > > > > I'll need to unescape it be I can use it. > > > > > > > > - Jim > > > > > > > > ______________________________ > > > > James Watkin > > > > ACIS Software Development > > > > The Anderson School at UCLA > > > > [EMAIL PROTECTED] > > > > Voice: 1-310-825-5030 > > > > Fax: 1-310-825-4835 > > > > ______________________________ > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > - > > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > > > > >--------------------------------------------------------------------- > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > ______________________________ > > James Watkin > > ACIS Software Development > > The Anderson School at UCLA > > [EMAIL PROTECTED] > > Voice: 1-310-825-5030 > > Fax: 1-310-825-4835 > > ______________________________ > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
