== "Object request.getAttribute(String objectName)" question ==
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   joey_corleon
Posted On:   Tuesday, October 8, 2002 05:09 AM

Hi, I have implemented a user bean (that is used to collect info about a user) named GCuserBean that inherit from 2 beans as follows: public abstract class MemberPureBaseBean extends java.lang.Object public class MemberBaseBean extends MemberPureBaseBean public class GCuserBean extends MemberBaseBean In my ActionForm::execute(), I create a bean of type GCuserBean and put it in the request object if it is not already there. I use the following calls: GCuserBean memberBean = (GCuserBean)request.getAttribute( memberBean ); if( memberBean == null ) { System.out.println("=I= member bean not found in session obj, had to create one!&qu   More>>

Hi,


I have implemented a user bean (that is used to collect info about a user) named GCuserBean that inherit from 2 beans as follows:


public abstract class MemberPureBaseBean extends java.lang.Object

public class MemberBaseBean extends MemberPureBaseBean

public class GCuserBean extends MemberBaseBean


In my ActionForm::execute(), I create a bean of type GCuserBean and put it in the request object if it is not already there.


I use the following calls:

GCuserBean memberBean = (GCuserBean)request.getAttribute( memberBean );

if( memberBean == null ) {

System.out.println("=I= member bean not found in session obj, had to create one!");

memberBean = new GCuserBean();

request.setAttribute( memberBean );

}

else {

System.out.println("=I= member bean FOUND in session obj!!!!");

}


The problem is that when I try to compile my ActionForm, I get the following errors:


org/apache/struts/webapp/validator/MultiRegistrationAction.java [88] getAttribute(java.lang.String) in javax.servlet.ServletRequest cannot be applied to (org.corproware.businessLogic.GCuserBean)
GCuserBean memberBean = (GCuserBean)request.getAttribute( memberBean );
^
org/apache/struts/webapp/validator/MultiRegistrationAction.java [92] setAttribute(java.lang.String,java.lang.Object) in javax.servlet.ServletRequest cannot be applied to (org.corproware.businessLogic.GCuserBean)
request.setAttribute( memberBean );
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -deprecation for details.
2 errors
Errors compiling src.


HOW COME? Knowing that a parent class of GCuserBean extends java.lang.Object?


Thanks

   <<Less

Re: == "Object request.getAttribute(String objectName)" question ==

Posted By:   joey_corleon  
Posted On:   Tuesday, October 8, 2002 05:14 AM

This was the stupid question of the day lol


Sorry about that - the calls should have been:


GCuserBean memberBean = (GCuserBean)request.getAttribute( "memberBean" );

if( memberBean == null ) {

System.out.println("=I= member bean not found in session obj, had to create one!");

memberBean = new GCuserBean();

request.setAttribute( "memberBean", memberBean );

}

else {

System.out.println("=I= member bean FOUND in session obj!!!!");

}


Joey

About | Sitemap | Contact