Wow, that's strange.  The test works but when the body
comes from the bean:write, it does not.  See this page:
http://agentnet.blitzdevelopment.com/public/articleSingle.do?articleID=4

It comes from the following:    
<textarea name="articleBody" cols="50" rows="5"
wrap="phsyical"><bean:write name="article"
property="articleBody"/></textarea>
<br>
<b>From bean:write</b><br>
<str:replace replace="NL" with="<br>" newlineToken="NL">
 <bean:write name="article" property="articleBody"/>
</str:replace>
<br><br>
<b>From string typed out in JSP</b><br>
<str:replace replace="NL" with="<br>"
newlineToken="NL">this is a t
est of newlines</str:replace>
<br><br>

I noticed that in the first example it does add one extra
<br> at the beginning but stops after that.

Calvin

--- Henri Yandell <[EMAIL PROTECTED]> wrote:
> 
> Well, some good news :)
> 
> Could you try to run the following as a tiny JSP page:
> 
> ----
> <%@ taglib
> uri="http://jakarta.apache.org/taglibs/string-1.0";
> prefix="str"
> %>
> 
> <str:replace replace="NL" with="<br>"
> newlineToken="NL">this is a t
> est of newlines</str:replace>
> ----
> 
> With a newline between the t and the est, and see if a
> <br> gets put in.
> If you look at:
> 
> http://orinoco.flamefew.net:8013/jstltest/testnewline.jsp
> 
> You can see it working, but that's on tomcat 4.0.4, so I
> need to upgrade
> or somesuch to check it still works.
> 
> What OS platform are you on? And Java version/provider?
> 
> Thanks,
> 
> Hen
> 
> 
> On Wed, 6 Nov 2002, Calvin Lau wrote:
> 
> > The good news is, I got str:replace to work.  It was
> the
> > missing commons-lang.jar.  Bad news is, still can't
> detect
> > the newlines.  The following didn't work but replacing
> > regular characters works fine.
> >
> > <str:replace replace="NL" with="<br>"
> newlineToken="NL">
> >   <bean:write name="article" property="articleBody"/>
> > </str:replace>
> >
> > Calvin
> >
> > --- Calvin Lau <[EMAIL PROTECTED]> wrote:
> > > I dont have the commons-lang jar =P
> > >
> > > I guess this is something new...it was a year and a
> half
> > > ago that I was last working on this.
> > >
> > > Thanks.
> > >
> > > --- Henri Yandell <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Just to check, the nightly build now should name
> things
> > > > taglib-string and
> > > > not string. So I'm a little unsure of how you
> changed
> > > > things out. When I
> > > > had to do it recently I had to make sure I removed
> the
> > > > string.* stuff [got
> > > > a weird error], put the taglib-string.* stuff in,
> and
> > > > changed the web.xml
> > > > accordginly [got another weird error].
> > > >
> > > > I may have been building myself and not via the
> nightly
> > > > build, so I'll
> > > > check that tomorrow.
> > > >
> > > > Just to check, do you have the commons-lang 1.0 jar
> in
> > > > your webapp as
> > > > well? The error is suspicious of something that
> either
> > > > died in there, or
> > > > couldn't find that jar.
> > > >
> > > > Hen
> > > >
> > > > On Wed, 6 Nov 2002, Calvin Lau wrote:
> > > >
> > > > > Thanks Henri.  I cant seem to get str:replace to
> work
> > > > at
> > > > > all, in the nightly build and the latest release
> > > > version.
> > > > >
> > > > > I tried using str:encodeURL in these two versions
> and
> > > > that
> > > > > worked fine but whenever I try str:replace (even
> a
> > > > simple
> > > > > case without newlines) I get the error pasted
> below.
> > > I
> > > > > still have the very old versions of string.tld
> and
> > > > > string.jar that I had been using, and after
> switching
> > > > back
> > > > > to those old files, str:replace worked again
> (just
> > > not
> > > > with
> > > > > newlines).
> > > > >
> > > > > Has anyone been able to use str:replace?  BTW,
> all I
> > > > did
> > > > > was replace the old string.jar and string.tld
> with
> > > the
> > > > new,
> > > > > and restart tomcat. web.xml didnt need changing
> since
> > > I
> > > > had
> > > > > already been using the tag library.
> > > > >
> > > > > The error I get when using str:replace
> > > > > =======================================
> > > > > 2002-11-06 23:29:28 ApplicationDispatcher[]
> > > > > Servlet.service() for servlet jsp threw exception
> > > > > org.apache.jasper.JasperException:
> > > > > org/apache/commons/lang/StringUtils
> > > > >       at
> > > > >
> > > >
> > >
> >
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
> > > > >       at
> > > > >
> > > >
> > >
> >
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
> > > > >       at
> > > > >
> > > >
> > >
> >
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
> > > > >       at
> > > > >
> > > >
> > >
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > > > >
> > > > >
> > > > >
> > > > > --- Henri Yandell <[EMAIL PROTECTED]>
> wrote:
> > > > > >
> > > > > > Hi Calvin,
> > > > > >
> > > > > > Try doing:
> > > > > >
> > > > > > <str:replace replace="NL" with="<br>"
> > > > newlineToken="NL">
> > > > > >   <bean:write name="article"
> > > property="articleBody"/>
> > > > > > </str:replace>
> > > > > >
> > > > > > Let me know if that works, if not then I'll get
> 4.1
> > > > > > installed and try it
> > > > > > out myself.
> > > > > >
> > > > > > Also be suspicious of the <br> in case it needs
> to
> > > be
> > > > > > &gt;br&lt; in the
> > > > > > new version. [Not that I'm saying it will be,
> just
> > > > > > stating the obvious :)]
> > > > > >
> > > > > > Hen
> > > > > >
> > > > > > On Wed, 6 Nov 2002, Calvin Lau wrote:
> > > > > >
> > > > > > > Can someone give me an example of how I would
> use
> > > > > > > string:replace to change all the newlines in
> a
> > > > chunk of
> > > > > > > text to <br> tags?  I had been using the
> > > following:
> > > > > > >
> 
=== message truncated ===


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to