Ack. Sorry Stefan. Hadn't noticd this thread becoming a String taglib one.
The only problem you should get when commenting out initAttributes should be that the following will happen: [test is an optional attribute] <str:foo/> test is default <str:foo test="blah"/> test is blah <str:foo/> test is blah [assuming container chooses to reuse same Tag] I'll look into the bug tonight and try and get a fix in the nightly build by end of the weekend. Thanks, Hen On Sat, 12 Oct 2002, Stefan wrote: > Hi, > > I downloaded the source and I made the changes to the StringTagSupport.java > as you speficified. Now when I try to use the taglib my Resin gives me this > error: > > java.lang.NoSuchMethodException: > org.apache.taglibs.string.SubstringTag.doStartTag() > > So I looked at the StringTagSupport.java again and noticed there is no > doStartTag() method ... seems strange. I don't know much about coding > taglibs so I am lost as to why this error is showing up when all I did was > comment out the line initAttributes() from doEndTag(). > > Any ideas? > > Stef > > > > > ----- Original Message ----- > From: "Martin Cooper" <[EMAIL PROTECTED]> > To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]> > Sent: Friday, October 11, 2002 8:43 PM > Subject: RE: Is there a way to call java.lang.String.substring on a <c: ou t > ? > > > > FYI, I've submitted a bug report (Bugzilla #13563) for this. > > > > -- > > Martin Cooper > > > > > > > -----Original Message----- > > > From: Martin Cooper [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, October 11, 2002 2:52 PM > > > To: 'Tag Libraries Users List' > > > Subject: RE: Is there a way to call > > > java.lang.String.substring on a <c: > > > ou t ? > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: Stefan [mailto:[EMAIL PROTECTED]] > > > > Sent: Thursday, October 10, 2002 10:52 PM > > > > To: Tag Libraries Users List > > > > Subject: Re: Is there a way to call > > > > java.lang.String.substring on a <c: > > > > ou t ? > > > > > > > > > > > > Hi, > > > > > > > > I have a weird behavior using the jakarta tag-lib with the > > > > JSTL forEach tag > > > > where when I apply the substring tag to a c:out tag the > > > > substring tag only > > > > works on the first iteration? > > > > > > > > > > > > <c:forEach items="${r.rows}" var="value" varStatus="status" > > > > > > > > > <tr align='center' > > > > > <td><c:out value="${value.sex}"/> </td> > > > > <td><c:out value="${value.name}"/> </td> > > > > <td><str:substring start="0" end="4"><c:out > > > > value='${value.lastName}'/></str:substring></td> > > > > </tr> > > > > </c:forEach> > > > > </table> > > > > > > > > Any ideas? > > > > > > There's a bug in the String taglib which will cause this to > > > happen whenever > > > you're running in a container which reuses tag handler instances. The > > > problem will show up with other tags in this taglib as well. > > > > > > The bug is actually in StringTagSupport.java, where > > > initAttributes() is > > > being called from within doEndTag(). Since the container is > > > not required to > > > reinitialise the attributes if they have the same values - > > > which they do in > > > your loop - you'll get incorrect results after the first > > > call. (In your > > > case, I think what you'll see is the entire string, instead > > > of the substring > > > you expected.) > > > > > > The fix is simply to remove the call to initAttributes() from > > > doEndTag(). > > > > > > -- > > > Martin Cooper > > > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Martin Cooper" <[EMAIL PROTECTED]> > > > > To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]> > > > > Sent: Friday, October 11, 2002 1:31 AM > > > > Subject: RE: Is there a way to call > > > > java.lang.String.substring on a <c: ou t > > > > ? > > > > > > > > > > > > > As the documentation for the String taglib states, it is > > > > built on the > > > > > Commons Lang component. The error you are seeing suggests > > > > that you have > > > > not > > > > > included Commons Lang in your web app. > > > > > > > > > > -- > > > > > Martin Cooper > > > > > > > > > > > > > > > > -----Original Message----- > > > > > > From: Stefan [mailto:[EMAIL PROTECTED]] > > > > > > Sent: Thursday, October 10, 2002 9:46 PM > > > > > > To: Tag Libraries Users List > > > > > > Subject: Re: Is there a way to call > > > > > > java.lang.String.substring on a <c: > > > > > > out ? > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > I just installed the string taglib and tried the simple > > > > > > example as found in > > > > > > the docs: > > > > > > > > > > > > <str:substring start="4" end="8">The tree is > > > > green.</str:substring> > > > > > > > > > > > > And I get this error: > > > > > > > > > > > > org/apache/commons/lang/NumberUtils > > > > > > > > > > > > I am using Resin 2.1.4 and placed the string.jar file > > > into the web > > > > > > applications WEB-INF\lib folder and added the > > > discriptor file to: > > > > > > > > > > > > WEB-INF\classes\tlds > > > > > > > > > > > > And finally I added this to the web.xml file: > > > > > > > > > > > > <taglib> > > > > > > > > > > > > > > > > > > > <taglib-uri>http://jakarta.apache.org/taglibs/string-1.0</taglib-uri> > > > > > > <taglib-location>/WEB-INF/string.tld</taglib-location> > > > > > > </taglib> > > > > > > > > > > > > > > > > > > Any ideas what I am doing wrong? > > > > > > > > > > > > Thanks > > > > > > > > > > > > ----- Original Message ----- > > > > > > From: "Tim Kettering" <[EMAIL PROTECTED]> > > > > > > To: "Tag Libraries Users List" <[EMAIL PROTECTED]> > > > > > > Sent: Friday, October 11, 2002 12:17 AM > > > > > > Subject: Re: Is there a way to call > > > > > > java.lang.String.substring on a <c:out ? > > > > > > > > > > > > > > > > > > > > > > > > > > http://jakarta.apache.org/taglibs/doc/string-doc/intro.html > > > > > > > > > > > > > > I'd suggest using the Strings taglib. Its really very > > > > > > nice, and comes > > > > > > with > > > > > > > a whole lot of other goodies you can use as well, rather > > > > > > than making a > > > > > > > one-off bean method that does the same thing. > > > > > > > > > > > > > > <str:substring start="4" end="8"> > > > > > > > <c:out value="${param.name}"/></str:substring> > > > > > > > > > > > > > > Or something like that. > > > > > > > > > > > > > > > > > > > > > > So I would wrap the <c:out value="${}}"/> tag with a > > > > > > JSTL string taglib > > > > > > or > > > > > > > > perhaps a bean method that returns a string like so: > > > > > > > > > > > > > > > > <%= myBean.myStringMethod(<c:out > > > > value="${param.name}}"/>) %> > > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > > > From: "Shawn Bayern" <[EMAIL PROTECTED]> > > > > > > > > To: "Tag Libraries Users List" > > > > <[EMAIL PROTECTED]> > > > > > > > > Sent: Thursday, October 10, 2002 11:36 PM > > > > > > > > Subject: Re: Is there a way to call > > > > > > java.lang.String.substring on a <c: > > > > > > out > > > > > > > > ? > > > > > > > > > > > > > > > > > > > > > > > >> On Thu, 10 Oct 2002, Stefan wrote: > > > > > > > >> > > > > > > > >>> So is there a way to extract a sub string from the > > > > > > result of a <c:out > > > > > > > >>> value="${}}"/> tag? > > > > > > > >> > > > > > > > >> No, not alone; you'd need to use the String Taglib or > > > > > > handle it with a > > > > > > > >> servlet or other custom Java logic (e.g., a bean > > > or servlet). > > > > > > > >> > > > > > > > >> -- > > > > > > > >> Shawn Bayern > > > > > > > >> "JSTL in Action" http://www.jstlbook.com > > > > > > > >> > > > > > > > >> > > > > > > > >> -- > > > > > > > >> To unsubscribe, e-mail: > > > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > >> For additional commands, e-mail: > > > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > To unsubscribe, e-mail: > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > For additional commands, e-mail: > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Tim Kettering > > > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > To unsubscribe, e-mail: > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > For additional commands, e-mail: > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > To unsubscribe, e-mail: > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > For additional commands, e-mail: > > > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > To unsubscribe, e-mail: > > > > <mailto:[EMAIL PROTECTED]> > > > > > For additional commands, e-mail: > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: > > > > <mailto:[EMAIL PROTECTED]> > > > > For additional commands, e-mail: > > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > For additional commands, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>