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=22734>.
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=22734

Error combining <jsp:forward> and response.encodeURL()

           Summary: Error combining <jsp:forward> and response.encodeURL()
           Product: Tomcat 4
           Version: 4.1.27
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


In my web application I have index.jsp forwarding to a struts action using the
following:

      <[EMAIL PROTECTED] contentType="text/html"%>
      <%String forwardTo = response.encodeURL("/home.do");%>
      <jsp:forward name="<%=forwardTo%>"/>

When a client first visits the site they get a 404 error stating "resource not
found" indicating that 'home.do;jsessionid=<yadda yadda>' could not be located.
 If the user hits reload, the page displays appropriately.

I found a post on comp.lang.java.programmer from an Emery Z. Balint Jr., dated
8/10/03, complaining of a similar problem.  In an email exchange he said he was
able to fix the problem by shutting off URL rewriting - a problem if the client
is a browser with cookies disabled.  It appears that both of our situations are
similar.  Here is a synopsis of the hypothesis I developed in an our email exchange:

"I removed the call to response.encodeURL() and the problem went away.  
Interestingly enough, I use encodeURL exclusively elsewhere in my 
application.  I do not encounter the same problem except in this instance 
where encodeURL is combined with a forward.  I anticipate that this is a 
result of the sequence of events that the servlet container goes through 
in establishing a session.  Perhaps a session is not fully registered 
until the completion of the first request-response cycle.  This would mean 
that the forward is trying to access a session object whose existence 
is not yet known to the rest of the servlet container.  The forward fails, 
but at the close of the transaction the session is fully 
created/registered/recognized, so the reload works."

And his response:
"Very interesting, you could be correct as to what is happening. Same for
me as well, no where else did the error occur, except for that first
time."

Mr. Balint and I are both using J2SE 1.4.1_02 and Tomcat 4.1.27.  I do not know
whether he is using Struts as well, though this seems immaterial.

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

Reply via email to