It's not the "why is formName null?" that I'm worried about.  In this
case, it's supposed to be null.

What I want to know is this: Is a NullPointerException supposed to be
thrown if the argument "name" in session.getAttribute(name) is NULL?  If
such an exception IS supposed to be thrown, was this a change put into
Tomcat 5.5.x that wasn't in 5.0.x?


-----Original Message-----
From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 12, 2008 11:24 AM
To: Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2
Subject: RE: getAttribute(null)?

At that point you're talking to the Struts 1.x Base class ActionConfig
getParameter method..

http://struts.apache.org/1.2.7/api/org/apache/struts/config/ActionConfig
.html#getParameter()
where JavaDoc for this parameter is defined as

public java.lang.String getParameter()

        Return general purpose configuration parameter that can be used
to pass extra information to the Action instance selected by this
Action. Struts does not itself use this value in any way.

As of Struts 2.0.11
http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts
2/dispatcher/mapper/ActionMapping.html

the getParameter() method has been refined e.g.

    /** @return The extra parameters */
    public java.util.Map getParams() {
        return params;
    }

relevant doc on java.util.Map
http://publib.boulder.ibm.com/infocenter/wsadhelp/v5r1m2/index.jsp?topic
=/com.sun.api.doc/java/util/Map.html

//code look something like
//assume the key for the form attribute will be called Form1 String
formKey=new String("Form1");

//And now to acquire the value for the Form1 key String value
=mapping.getParams().get(formKey);

Let me know if does'nt conform to your understanding..
HTH
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and
Sender does not endorse distribution to any party other than intended
recipient. Sender does not necessarily endorse content contained within
this transmission. 


> Subject: getAttribute(null)?
> Date: Thu, 12 Jun 2008 10:44:06 -0400
> From: [EMAIL PROTECTED]
> To: users@tomcat.apache.org
> 
> I have the following code that worked in Tomcat 5.0, but doesn't work 
> in Tomcat 5.5.26:
> 
> String formName = mapping.getAttribute(); // mapping is a variable of 
> type ActionMapping. In this scenario, formName is null.
> 
> if (null != session.getAttribute(formName)) { 
> session.removeAttribute(formName);
> }
> 
> 
> formName is null. In Tomcat 5.0.x, no exception was thrown and 
> processing continued (as if passing a null argument to getAttribute 
> simply returned NULL). In Tomcat 5.5.26, a ServletException is thrown 
> (with a NullPointerException).
> 
> I know how to code a work-around (and have done so), but is this 
> considered a bug in Tomcat?
> 


________________________________

Enjoy 5 GB of free, password-protected online storage. Get Windows Live
SkyDrive.
<http://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Ref
resh_skydrive_062008> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to