On Tue, 17 Sep 2002, zze-JEANJEAN S ext FTRD/DMI/SOP wrote:

> > > Is there a tag to convert \n to <br/> ??
> >
> > You should be able to use the String Taglib or the Regexp Taglib.
> >
> The str:replace tag is not easy to use : in the replace propertie the \n
> is not understood :(( You have to put in this propetie a real new line,
> so the code is not really readable :(
> For instance :
> ...
> <str:replace replace="
> " with="<BR/>"><c:out
> value="${requestScope[theKey].address1}"/></str:replace>
> ...

Yeah. This needs to be solved doesn't it.

Solutions:

Make replace accept \n as being a newline. This would be doable, but what
if someone wanted to replace a \n sequence? Is it acceptable to make
'tabs' illegal in the replace etc. Probably not.

Add a replaceJava attribute, for specifying the replace tag as a Java
attribute. Would want a withJava attribute too.
Or maybe this is an encoding="java" attribute.

Have a replaceNewline tag. A bit weak as you won't be able to replace
something with a newline in. Also has weaknesses as I'm trying to collate
similar functionality and not create more tags.

====
I seem to recall that there are no XML character entities that work
there, but possible I could make one work. Whether this would be
cross-server though, I don't know.

Most people will want \n to work I imagine, and won't care that they have
to do \\n to replace a \ and a n. If I change it so that all
String attributes get unescaped for Java entities, and maybe even all
content as well. I wonder if this will hurt anything...

If not, I'll aim for this feature to be in a 2.0 release. My apologies for
not being able to get it in sooner.

Hen


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

Reply via email to