I didn't try it myself, but the docs say that <c:param>
encodes using URLEncoder.encode() - so there should
not be any "&" style encoding and URLDecoder.decode
should work fine.  But I don't speak from experience.
- Dan

> -----Original Message-----
> From: Martin van Dijken [mailto:[EMAIL PROTECTED]
> Sent: Sunday, January 25, 2004 11:31 PM
> To: 'Tag Libraries Users List'
> Subject: RE: Tag to Unescape an HTML String?
> 
> 
> 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 &amp;.
> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to