Does it mean that all the tag lib from the Manning Book are wrong with theses TagLib specs? The manning tag lib will never work on the 4.1.18 environment.
E.L. -----Original Message----- From: John Trollinger [mailto:[EMAIL PROTECTED]] Sent: February 6, 2003 8:40 AM To: 'Tomcat Users List' Subject: RE: Bug? in Tomcat 4.1.18 with TagLib This is because of tag pooling. Please see http://issues.apache.org/bugzilla/show_bug.cgi?id=13392 or http://issues.apache.org/bugzilla/show_bug.cgi?id=16001 or http://issues.apache.org/bugzilla/show_bug.cgi?id=10220 And there are lots more. John > -----Original Message----- > From: Etienne [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 8:30 AM > To: [EMAIL PROTECTED] > Subject: Bug? in Tomcat 4.1.18 with TagLib > > > Hi, > > I am new to this list, and I add problem retrieving archive, > so sorry if that question was already answered. > > My web application was running on tomcat 3,2 and 4.0.3 it was > running well. Now that I have switch to Tomcat 4.1.18 I have > a strange problem with one of my custom tag. It seems that > the local variables in the > doStartTag() method are not cleared after the tag, something > is not calling the clearProperties() method at the end of > each tag. But if I put clearProperties() inside the > doStartTag(), it is working better. But I cannot still get a > random number for each image. The main idea is that every tag > on the page is using the same value for some variable. It > shouldn't happen. Any idea? > > By the way, I think I can fix it by clearing each value in > the doStartTag(), but I still don't understand why is was > working on Tomcat 3.2, 4.0.3 and not and 4.1.8. The specs > says that the variables should be clean with the > clearProperties() after the end of the tag. Is there a > problem of configuration on my side? > > Here's the code, I use the Manning "Jsp Tag Library" classes > as a base. > > package my.taglib.html; > > import my.taglib.util.LocalStrings; > import my.taglib.util.ExTagSupport; > import java.util.Properties; > import javax.servlet.jsp.JspException; > import javax.servlet.jsp.JspTagException; > import java.util.Random; > public class DwRollTag extends ExTagSupport { > > static LocalStrings ls = > LocalStrings.getLocalStrings(TestHtmlTag.class); > protected String url = null; > protected String imgid = null; > protected String image = null; > protected String imageOut = null; > > public void setUrl(String url) {this.url = url;} > public void setImgid(String imgid) {this.imgid = imgid;} > public void setImage(String image) {this.image = image;} > public void setImageOut(String imageOut) {this.imageOut = > imageOut;} > > > public int doStartTag() throws JspException{ > > if(null==url){url = "";} > if(null==image){image = ""; imageOut="";} > if(imgid == null){ imgid = getRandom();} > if(imageOut == null){imageOut = getImageOut(image);} > System.err.println(" image :" + image + ", url : > " + url + ", imgid : " + imgid+ ", imageOut : " + imageOut); > > try { > pageContext.getOut().print(getImageRoll(url, > imgid, image, imageOut)); > } catch(java.io.IOException ioe) { > > // User probably disconnected ... > log(ls.getStr("error"), ioe); > throw new JspTagException(ls.getStr("error")); > } > > return SKIP_BODY; > } > > protected String getRandom(){ > Random wheel = new Random() ; > int unique = ( wheel.nextInt() & Integer.MAX_VALUE ) > %900000 + 100000 ; > return "" + unique; > } > > /** > * short version of getImageRoll, locationOut is named form > the location in + a "_over" just > * before the file extention > * > * @param name > * @param locationIn > * @return > */ > public String getImageOut(String image){ > String imageOut; > int length = image.length(); > int dot = image.lastIndexOf("."); > String first = ""; > String last = ".gif"; > if(dot!=-1){ > first = image.substring(0,dot); > last = image.substring(dot, length); > } > imageOut = first+"_over"+last; > return imageOut; > } > > /** > * getImageRoll return a typical rollover statement used by a > standard javascript function "changeImage()" > * @param name > * @param locationIn > * @param locationOut > * @return > */ > public String getImageRoll(String url, > String imgid, > String image, > String imageOut){ > > String retString = "<a href=\""+url+"\" > onMouseOut=\"MM_swapImgRestore()\" > onMouseOver=\"MM_swapImage('"+imgid+"','','"+imageOut+"',1)\"><img > name=\""+imgid+"\" border=\"0\" src=\""+image+"\"></a>"; > return retString; > } > > > protected void clearProperties(){ > url = null; > imgid = null; > image = null; > imageOut = null; > super.clearProperties(); > } > > } > > > > tks > > E. L. > [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
