Did you check that you are put-ing (into the Context) the correct object (the one you 
expect to get afterwards?)?

 

Have you verified that the value you are put-ing (in case it’s the right one) is not 
being (unexpectedly) overwritten?

 

Are you using (/importing) more than one class with that same name (different package)?

 

-----Mensaje original-----
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 12 de febrero de 2004 14:26
Para: Struts Users List (E-mail)
Asunto: Reading Context Data

 

Does anyone know how to read object data out of the context? 

I have a web app which puts a Bean in to the web context data.  It then forwards to my 
struts applications.  From within my action when I try to read string data out of the 
context attribute, I have no problems.  When I try to read the bean data out of the 
context, I keep getting a ClassCastException.  Does anyone know what I am doing wrong. 
 Here are the lines from my action:

     MDF_UserBean user = new MDF_UserBean(); 
     ServletContext ctx = this.getServlet().getServletContext(); 
      ctx = ctx.getContext("/emdf"); 
      user = (MDF_UserBean)ctx.getAttribute("mdfUser"); 

Thanks in advance 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

Reply via email to