You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by L Rutker <lr...@hotmail.com> on 2002/02/01 18:59:34 UTC

Scope Bug in 4.01 !

Hi,
The following is a bug I found using Tomcat 4.01 on NT4
The following code:

<% if (request.getParameter("type")!= null && 
request.getParameter("type").equals("user")) { %>
    <jsp:useBean id="user" class="com.rutker.UsrData" scope="request"/>
<% } else if(request.getParameter("type")!= null && 
request.getParameter("type").equals("group")) { %>
    <jsp:useBean id="group" class="com.rutker.GpData" scope="request"/>
<% } %>

should not be visible to the
<jsp:getProperty name="user" property="firstName" />  tag  farther down the 
page because the useBean tag was declared in the if block, yet the 
jsp:getProperty tag can see it and works in Tomcat. I noticed the bug when I 
tried the above code on WL 6.1 on Linux and it didnt work. I think that WL 
has the proper implementation.
Is this the correct mailing list for this post?
Thanks
Lou R.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Scope Bug in 4.01 !

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 1 Feb 2002, L Rutker wrote:

> Date: Fri, 01 Feb 2002 12:59:34 -0500
> From: L Rutker <lr...@hotmail.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: <jsp:useBean /> Scope Bug in 4.01 !
>
> Hi,
> The following is a bug I found using Tomcat 4.01 on NT4
> The following code:
>
> <% if (request.getParameter("type")!= null &&
> request.getParameter("type").equals("user")) { %>
>     <jsp:useBean id="user" class="com.rutker.UsrData" scope="request"/>
> <% } else if(request.getParameter("type")!= null &&
> request.getParameter("type").equals("group")) { %>
>     <jsp:useBean id="group" class="com.rutker.GpData" scope="request"/>
> <% } %>
>
> should not be visible to the
> <jsp:getProperty name="user" property="firstName" />  tag  farther down the
> page because the useBean tag was declared in the if block, yet the
> jsp:getProperty tag can see it and works in Tomcat. I noticed the bug when I
> tried the above code on WL 6.1 on Linux and it didnt work. I think that WL
> has the proper implementation.

I don't.  They are violating the JSP Specification if they support this.
In the JSP 1.3 Specification, Section 4.1 (page 68), you will find the
following statement:

    "Duplicate ids found in the same translation unit
    shall result in a fatal translation error."

The fact that you are doing this inside scriptlet conditionals does not
change the fact that you are using two <jsp:useBean> elements with the
same "id" attribute in the same page.

> Is this the correct mailing list for this post?

The best place to report bugs is in the bug tracking system:

  http://nagoya.apache.org/bugzilla/


> Thanks
> Lou R.
>

Craig McClanahan


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>