DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4910>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4910

taglib bug

           Summary: taglib bug
           Product: Tomcat 4
           Version: 4.0.1 Final
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Major
          Priority: Other
         Component: Jasper
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I' am trying to upgrade from Tomcat 3.2.3/ Apache 1.3.19 to Tomcat
4.0.1/ Apache 1.3.19 on Linux.

All the urls in the jsps of my application are rewritten by a
UrlTag. The UrlTag Class takes the url between the tags and rewrites
it if necessary.

It works with Tomcat 4.0.1 if the url is placed in the jsp file
statically. It works not if the url is get by using the "get"-method
of a bean.

With Tomcat 3.2.3 it worked fine in both cases. So I think it could by a bug.

Here is an example:

### example.jsp ###

<A href="<myLib:url><%= myBean.getURL() %></myLib:url>">text</A>


### output Tomcat 3.2.3 (right) ###

<A href="http://localhost/target.jsp";>text</A>


### output Tomcat 4.0.1 (wrong) ###

<A href="<%= myBean.getURL() %>">text</A>


### example.tld ###

<tag>
  <name>url</name>
  <tagclass>de.iop.webrun.shared.taglib.UrlTag</tagclass>
  <bodycontent>tagdependent</bodycontent>
  <info>rewrite url</info>
</tag>


### UrlTag-Code ###

import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.io.IOException;

public class UrlTag extends BodyTagSupport
{
  public int doAfterBody() throws JspException
  {
    BodyContent bodyContent = getBodyContent();
    String baseURL          = bodyContent.getString();
    bodyContent.clearBody();
    try
    {
      HttpServletResponse response = (HttpServletResponse)
      pageContext.getResponse();
      String encodedURL = response.encodeURL(baseURL);
      this.getPreviousOut().print(encodedURL);
    }
    catch(IOException e)
    {
      throw new JspTagException("I/O exception " + e.getMessage());
    }
    return SKIP_BODY;
  }
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to