luehe       2003/02/13 15:04:26

  Modified:    jasper2/src/share/org/apache/jasper/runtime
                        JspContextWrapper.java
  Log:
  Implemented semantics on JspContextWrapper that if the attribute value
  passed to setAttribute is null, this has the same effect as calling
  removeAttribute.
  
  Revision  Changes    Path
  1.15      +16 -8     
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java
  
  Index: JspContextWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspContextWrapper.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- JspContextWrapper.java    7 Feb 2003 02:51:32 -0000       1.14
  +++ JspContextWrapper.java    13 Feb 2003 23:04:26 -0000      1.15
  @@ -163,15 +163,23 @@
        return invokingJspCtxt.getAttribute(name, scope);
       }
   
  -    public void setAttribute(String name, Object attribute) {
  -     pageAttributes.put(name, attribute);
  +    public void setAttribute(String name, Object value) {
  +     if (value != null) {
  +         pageAttributes.put(name, value);
  +     } else {
  +         removeAttribute(name, PAGE_SCOPE);
  +     }
       }
   
  -    public void setAttribute(String name, Object o, int scope) {
  +    public void setAttribute(String name, Object value, int scope) {
        if (scope == PAGE_SCOPE) {
  -         pageAttributes.put(name, o);
  +         if (value != null) {
  +             pageAttributes.put(name, value);
  +         } else {
  +             removeAttribute(name, PAGE_SCOPE);
  +         }
        } else {
  -         invokingJspCtxt.setAttribute(name, o, scope);
  +         invokingJspCtxt.setAttribute(name, value, scope);
        }
       }
   
  
  
  

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

Reply via email to