tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject Re: Dynamic string replacement?
Date Wed, 11 Sep 2002 17:13:15 GMT

Care to give an example?

Are you suggesting a bean called:

ReplacerBean

with properties

replacerBean.with
replacerBean.replace
replacerBean.text

or some such?

Seems unintuitive.


On Wed, 11 Sep 2002, Vernon Wu wrote:

>
> That can be done by using a Java bean conjoining with JSTL.
>
> 9/11/2002 6:03:47 AM, Eric.Lewis@swissinfo.ch wrote:
>
> >Hi all
> >
> >It looks like I found something to implement in the String Tag Library  :-)
> >
> >What I'm trying to do is to create links within a text, i.e. replacing 'the
> >text' with '<a href="...">the text</a>'. The problem is that both the
text
> >and the link are dynamic.
> >However, the String Tag Library won't let me replace things dynamically.
> >
> >Consider this:
> >
> ><c:set var="a" value="This will be replaced"/>
> ><c:set var="b" value="The new text"/>
> ><c:out value="${a}"/><br>
> ><c:out value="${b}"/><br>
> ><str:replace replace="This will be replaced" with="The new text">And he
> >said: "This will be replaced!".</str:replace>
> >
> >will show
> >
> >This will be replaced
> >The new text
> >And he said: "The new text!".
> >
> > - works like a charm! However,
> >
> ><c:set var="a" value="This will be replaced"/>
> ><c:set var="b" value="The new text"/>
> ><c:out value="${a}"/><br>
> ><c:out value="${b}"/><br>
> ><str:replace replace="${a}" with="${b}">And he said: "This will be
> >replaced!".</str:replace>
> >
> >won't replace anything:
> >
> >This will be replaced
> >The new text
> >And he said: "This will be replaced!".
> >
> >
> >And
> >
> ><c:set var="a" value="This will be replaced"/>
> ><c:set var="b" value="The new text"/>
> ><c:out value="${a}"/><br>
> ><c:out value="${b}"/><br>
> ><str:replace replace="<c:out value="${a}"/>" with="<c:out
> >value="${b}"/>">And he said: "This will be replaced!".</str:replace>
> >
> >even gives me an exception:
> >
> >javax.servlet.ServletException: /jsp/test.jsp(206,40) Attribute ${a} has no
> >value
> >
> >
> >This would be very, very handy if it worked... actually for all of the
> >String tag library.
> >
> >Thanks & regards,
> >Eric
> >
> >
> >--
> >To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>
> >
> >
>
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>
>
>


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


Mime
View raw message