You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kamholz, Keith (corp-staff) USX" <kk...@moog.com> on 2002/06/13 21:57:49 UTC
Bean Instances
Hey everyone,
I have a question for anyone that wouldn't mind helping me out a little bit.
I have a form that stores a property in bean.
I have a separate action mapped in my struts-config that is run from a
different page that uses the same bean name. however, it seems to create a
new instance of the bean. If i'm using the same bean name, is a new
instance created for each action that i have mapped (that uses the same
action class) or is it supposed to reuse that same instance?
I'm not sure if I've been been clear enough about what I'm trying to say,
but hopefully it's understandable.
Keith Kamholz
Moog
East Aurora, NY
(716) 687-7282
kkamholz@moog.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Bean Instances
Posted by M Katz <mk...@yahoo.com>.
If I understand what you want, here is an example of how we do this:
Here is the the java action and by using the input form, we can get a connection to the original instance
and get thisReportForm. I hope this helps. The InsCommonReportForm is a common bean that our workgroup uses for different jsps.
It sounds like you want to do a similar thing.
public ActionForward perform( final ActionMapping mapping,
final ActionForm form,
final HttpServletRequest request,
final HttpServletResponse response)
throws IOException, ServletException
{
if( isDebug() )
log( "In perform method - DetailedDependent21ReportAction" );
// Create Struts application errors object
final ActionErrors errors = new ActionErrors();
RequestResult result = null;
ActionForward forwardURL = null;
final InsCommonReportForm thisReportForm = (InsCommonReportForm)form;
Now use thisReportForm.methods/attributes names and go.
"Kamholz, Keith (corp-staff) USX" <kk...@moog.com> wrote: Hey everyone,
I have a question for anyone that wouldn't mind helping me out a little bit.
I have a form that stores a property in bean.
I have a separate action mapped in my struts-config that is run from a
different page that uses the same bean name. however, it seems to create a
new instance of the bean. If i'm using the same bean name, is a new
instance created for each action that i have mapped (that uses the same
action class) or is it supposed to reuse that same instance?
I'm not sure if I've been been clear enough about what I'm trying to say,
but hopefully it's understandable.
Keith Kamholz
Moog
East Aurora, NY
(716) 687-7282
kkamholz@moog.com
--
To unsubscribe, e-mail:
For additional commands, e-mail:
---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup