struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Villalba Arias, Fredy [BILBOMATICA]" <fvilla...@mailext.com>
Subject RE: Reading Context Data
Date Fri, 13 Feb 2004 10:37:57 GMT
Ok. Let me know if that works.

Good luck!

-----Mensaje original-----
De: Rassmann, Natalie D [mailto:natalie.d.rassmann@lmco.com] 
Enviado el: viernes, 13 de febrero de 2004 11:32
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

Attached is the servlet code from the other context which puts the
attribute in the context....

Yes I did have that import.  I think you may be on to something here.  I
will clean up files and see if that helps.  Right now, I had created a jar
file using the classes from the other servlet context to use in the type
cast.  But maybe the other classes are still there.  I will definitely
check that out.

Thanks for taking the time to help me.  I have been stuck on this for a
couple of days; it just doesn't make any sense.

Natalie

-----Original Message-----
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:fvillalba@mailext.com]
Sent: Thursday, February 12, 2004 11:57 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


1 questions... I can't see where the "mdfUser" attribute is set. Where is
it?

1 comment:

There is a line that gets my attention:

//import data.DTO.MDF_UserBean;  (inside LoginEmdfCrPktAction.java)

Is it possible that for some reason you are trying to cast a
data.DTO.MDF_UserBean to beans.MDF_UserBean? This happens sometimes,
especially if you are using and IDE, because the classes don't get
refreshed properly and then the conflict arises.

Have you tried deleteing ALL classes & JARS and recompiling + repackaging
+ redeploying EVERYTHING (sounds desperate, but sometimes it works)?

Will keep working on it.

Bye.

-----Mensaje original-----
De: Rassmann, Natalie D [mailto:natalie.d.rassmann@lmco.com]
Enviado el: jueves, 12 de febrero de 2004 17:32
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

okay here is the code in a zip file.  I included the action and the jar
file where the bean in question is imported from.  I also included the
source code for the bean.

Any help you could provide would be much appreciated.

Thanks,

Natalie

-----Original Message-----
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:fvillalba@mailext.com]
Sent: Thursday, February 12, 2004 11:25 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


So am I!

If you send me the stack trace, the source code where the "put" gets done
and the source code containing the "get", I might spare some time to give
it a look. The action mapping would also help.

Can't promess anything. Don't expect and answer for today, ok? (have work
to do)  :)

Regards,
Freddy.


-----Mensaje original-----
De: Rassmann, Natalie D [mailto:natalie.d.rassmann@lmco.com]
Enviado el: jueves, 12 de febrero de 2004 17:06
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

Yes I have verified the information is in the attribute.  I can extract it
and put it into an object variable just fine.  I can do a getClass on the
object variable and it is the right class name (beans.MDF_UserBean).  It
is when I do the direct cast with the class name that I get the
ClassCastException.

MDF_UserBean user = (MDF_UserBean)request.getAttribute("mdfUser");

This works:

Object user = (Object)request.getAttribute("mdfUser");

I am not importing more than one class with the same name either....

I am baffled; this should work.

-----Original Message-----
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:fvillalba@mailext.com]
Sent: Thursday, February 12, 2004 8:58 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


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:natalie.d.rassmann@lmco.com]
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


---
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


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---
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


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---
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
 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message