That works for me as well.  Would it have something to do
with how it's store in MySQL?  I've always treated newlines
as \n when working with MySQL and PHP and haven't had a
problem.  


--- Henri Yandell <[EMAIL PROTECTED]> wrote:
> 
> Okay, next attempt Calvin :)
> 
> <%@ taglib prefix="bean" uri="/WEB-INF/struts-bean.tld"
> %>
> <%@ taglib
> uri="http://jakarta.apache.org/taglibs/string-1.0";
> prefix="str" %>
> <%
>   session.setAttribute("foo", new
> java.util.EventObject("ga\nar") );
> %>
> 
> <str:replace replace="NL" with="<br>"
> newlineToken="NL"><bean:write name="foo"
> property="source"/></str:replace>
> 
> This works for me. Does it work for you?
> 
> I'm on latest version of Struts, 1.0.2.
> 
> Hen
> 
> On Thu, 7 Nov 2002, Henri Yandell wrote:
> 
> >
> > Good call on using the same text in an article, was
> about to transfer
> > suspicion to the piece of text in the article :)
> >
> > So.. that suggests something odd in bean:write. As a
> quick check, because
> > I've got it setup, the following does work:
> >
> > <%@ taglib prefix="c"
> uri="http://java.sun.com/jstl/core"; %>
> > <%@ taglib
> uri="http://jakarta.apache.org/taglibs/string-1.0";
> prefix="str" %>
> >
> > <str:replace replace="NL" with="<br>"
> newlineToken="NL"><c:out value="this is a t
> > est of newlines"/></str:replace>
> >
> > [newline between t and est]
> >
> > so it's not simply a problem with a tag inside the tag.
> If you have the
> > time and JSTL installed, then running the above would
> be good to rule that
> > out. I'll aim to get struts setup next and use
> bean:write instead.
> >
> > Hen
> >
> > On Wed, 6 Nov 2002, Calvin Lau wrote:
> >
> > > 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
> 
=== 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