I've been looking at the 1.0 and (draft) 1.1 JSP specs as
well as the 2.1 and (draft) 2.2 Servlet specs.  I have some
questions about request attributes.

The JSP javadoc have these overloaded methods on the PageContext:

  public abstract Object getAttribute(String name, int scope)
  public abstract void setAttribute(String name, Object o, int scope)
  public abstract void removeAttribute(String name, int scope)

I understand that the scope can be one of PAGE_SCOPE,
REQUEST_SCOPE, SESSION_SCOPE, or APPLICATION_SCOPE.

First, the JSW DK 1.0 EA PageContext doesn't seem to have
these versions of get/set Attribute.  Instead they call
them:

  getAttributeWithScope()
  setAttributeInScope()
  removeAttributeInScope()

with otherwise the same method signatures.

Which is correct?  The spec or the source code?  I assume
the spec, since it seems a bit cleaner.  If so, when will
Sun ship conformant code?  It seems remarkable to me that
Sun doesn't provide a conformant jsp.jar file.  I can
understand bugs in an early access reference implementation,
but in the interface files?


Second.  In implementing removeAttribute it seem's easy
enough to do with public Servlet methods in most cases, but
is a problem for the REQUEST_SCOPE.  A ServletRequest
doesn't have a removeAttribute() method and the
setAttribute() method is described as follows in the Servlet
2.1 javadocs:

    Throws: IllegalStateException
            if the named attribute already has a value.

This seems to preclude the obvious "call setAttribute with a
null value" solution.

Also, the Servlet spec (and JSP specs) are unclear if the
required attributes when including a request are to be unset
after the request or what the values for those attributes
are for nested includes.

I could use internal methods to implement this functionality
but it's seems like a bug in the Servlet spec that all the
other scopes have a removeAttribute() method except for
request.

Thanks.

Howard

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to