Re: ActionForm 'reset' method being called when JSP is rendered

2003-06-20 Thread Ted Husted
As Craig mentioned, reset is always called before an autopopulation 
event. For consistency, it is also called if the html:form tag needs to 
instantiate the form itself.

In a multi-action sequence, the request is run through the same gauntlet 
each time. A forwarded request within the container is not treated any 
differently than a new request from a client. So, as mentioned, you have 
to be careful about the resets.

In general, you only need to reset checkboxes when a form is in session 
scope. People tend to reset other properties as well, but that generally 
serves no purpose, since they will be overwritten anyway.

In Jerry's case, he indicated reset was being called when forwarding 
directly to a JSP. Since the request for a *.jsp would not pass through 
the ActionServlet, the only other way for reset to be called would be if 
the ActionForm is being instantiated by the html:form tag.

-Ted.

Paul Harrison wrote:
I have looked at this again, and in 1.1 rc2 on tomcat 4.1.18 the reset 
is called for each action of a multi action sequence sharing a form bean 
even though the form bean is in session scope and only created once - I 
have written a demo app with logging that shows this behaviour - should 
I submit a bug if this is not what is intended to happen.

Paul.

Paul Harrison wrote:

I am writing an application with a series of wizard type pages, so I 
thought that I would use one big ActionForm in session scope and each 
page add extra information to it - however this did not work as reset 
was being called at each page invocation - I am interested to hear 
that reset should only be called at instantiation time, because I 
believe that in 1.1 RC2 it is being called more often  than that - I 
can did out the old verision of the code to have a look at the exact 
circumstances if necessary

Ted Husted wrote:

In Struts 1.0.2 and later, reset is called by the html:form tag *if* 
the ActionForm is being instantiated at that time. The scope 
shouldn't matter.

Also remember that the html:form tag is looking at the Action to 
which it submits, which may not be Action 1. If these are the same 
Action, or share the same formbean under the same attribute, then the 
ActionForm should already exist, and reset should not be called.

-Ted.

Jerry Jalenak wrote:

I'm seeing some odd behaviour with one of my actions.  If anyone can 
explain
this I'd sure appreciate it

Here's what I've got - in struts-config I have an ActionForm that is 
shared
by two Actions.  The ActionForm is created in session scope by the 
first
action, and referenced by the second Action (also in session).  
Tracing the
calls to 'reset' and 'validate' I see the following:

JSP is displayed  - html form is submitted - 'reset' is called -
'validate' is called - Action 1 is performed - forward to next JSP -
'reset' is called - JSP is displayed
/\/\/\/\/\/\/\ !
My understanding is that 'reset' should not be called again until 
the form
on the second JSP is submitted.  Have I completely mis-understood 
how this
works?  Or is it something due to the ActionForm being created in 
session
scope?

TIA!

Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496
[EMAIL PROTECTED]

This transmission (and any information attached to it) may be 
confidential and is intended solely for the use of the individual or 
entity to which it is addressed. If you are not the intended 
recipient or the person responsible for delivering the transmission 
to the intended recipient, be advised that you have received this 
transmission in error and that any use, dissemination, forwarding, 
printing, or copying of this information is strictly prohibited. If 
you have received this transmission in error, please immediately 
notify LabOne at the following email address: 
[EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--
Ted Husted,
Struts in Action http://husted.com/struts/book.html


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ActionForm 'reset' method being called when JSP is rendered

2003-06-20 Thread Ted Husted
Jerry Jalenak wrote:
The doStartTag has a call to initFormBean; in initFormBean there is a call
to RequestUtils.createActionForm, followed by a call to the ActionForms
'reset' method.  In a wizard type of application, this could indeed cause
problems where the reset method may be clearing values from the ActionForm;
I've had to add code to a couple of my projects to check the mapping to see
if I wanted to reset or not.  Maybe one of the guru's could shed some light
on why the html:form/ tag would instantiate the ActionForm and call reset
when the JSP is rendered, opposed to doing this when the form is actually
submitted
In the normal course, the ActionForm is instantiated by the controller, 
and reset is called before autopopulation. Some people use reset for 
things aside from clearing fields, and so reset is also called if the h 
html:form tag needs to instatiate the form.

The mistake most people make is resetting properties needlessly. 
Generally, the one and only property that needs to be cleared by reset 
is a checkbox in session scope. This is simply because an unchecked box 
is not submitted. If the bean is in session scope, there is no way to 
turn it off again, and without reset, it remains forever true.

I would hazard to say that the best practice should be to use code like 
this in your reset method

if ((SESSION.equals(mapping.getScope())) setMyCheckbox(false);

and to never clear any other property without a specific cause.

-Ted.

--
Ted Husted,
Struts in Action http://husted.com/struts/book.html


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ActionForm 'reset' method being called when JSP is rendered

2003-06-20 Thread Jing Zhou

- Original Message - 
From: Ted Husted [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, June 20, 2003 6:10 AM
Subject: Re: ActionForm 'reset' method being called when JSP is rendered


 Jerry Jalenak wrote:
  The doStartTag has a call to initFormBean; in initFormBean there is a
call
  to RequestUtils.createActionForm, followed by a call to the ActionForms
  'reset' method.  In a wizard type of application, this could indeed
cause
  problems where the reset method may be clearing values from the
ActionForm;
  I've had to add code to a couple of my projects to check the mapping to
see
  if I wanted to reset or not.  Maybe one of the guru's could shed some
light
  on why the html:form/ tag would instantiate the ActionForm and call
reset
  when the JSP is rendered, opposed to doing this when the form is
actually
  submitted

 In the normal course, the ActionForm is instantiated by the controller,
 and reset is called before autopopulation. Some people use reset for
 things aside from clearing fields, and so reset is also called if the h
 html:form tag needs to instatiate the form.

 The mistake most people make is resetting properties needlessly.
 Generally, the one and only property that needs to be cleared by reset
 is a checkbox in session scope. This is simply because an unchecked box
 is not submitted. If the bean is in session scope, there is no way to
 turn it off again, and without reset, it remains forever true.

I guess for new Struts users they should also be aware of the need of
resetting array or array list for select menu and multibox, am I right?
I have been constantly researching a general algorithm of the resetting
properties for the Struts framework, but it is very hard to be *general*
even though I got one for our own product.


 I would hazard to say that the best practice should be to use code like
 this in your reset method

 if ((SESSION.equals(mapping.getScope())) setMyCheckbox(false);

 and to never clear any other property without a specific cause.

 -Ted.


 -- 
 Ted Husted,
 Struts in Action http://husted.com/struts/book.html



Jing
Netspread Carrier at http://www.netspread.com

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ActionForm 'reset' method being called when JSP is rendered

2003-06-20 Thread Yansheng Lin

I don't know, I have a feeling that a lot of people expect reset() should work
like the reset button we see everyday on the web.  As first I thought reset()
was called whenever html:reset button was pushed, but apparently it's been
called more often than that!

Specific to checkbox, if you default it to true, I don't know how you would use
it.  When it's unchecked, it's not submitted and the form would default it to
true, there is no way to submit an unchecked checkbox.  I might be wrong, but
I've never been able to use a checkbox default to true as far as I can remember.

Thanks! 



-Original Message-
From: Ted Husted [mailto:[EMAIL PROTECTED] 
Sent: June 20, 2003 5:10 AM
To: Struts Users Mailing List
Subject: Re: ActionForm 'reset' method being called when JSP is rendered


The mistake most people make is resetting properties needlessly. 
Generally, the one and only property that needs to be cleared by reset 
is a checkbox in session scope. This is simply because an unchecked box 
is not submitted. If the bean is in session scope, there is no way to 
turn it off again, and without reset, it remains forever true.

I would hazard to say that the best practice should be to use code like 
this in your reset method

if ((SESSION.equals(mapping.getScope())) setMyCheckbox(false);

and to never clear any other property without a specific cause.

-Ted.


-- 
Ted Husted,
Struts in Action http://husted.com/struts/book.html



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ActionForm 'reset' method being called when JSP is rendered

2003-06-19 Thread Jerry Jalenak
Ted,

After I sent the original e-mail I found out that one of my developers had
changed where the ActionForm was initially instantiated.  The first JSP is
calling an Action (via a html:link/ that does NOT have an ActionForm
associated with it.  This Action preloads a series of JavaBeans and then
forwards to the second JSP.  The Action associated with this JSP does have
the ActionForm associated with it, and since the ActionForm has never been
instantiated, the html:form/ tag was doing it at that time.  I guess I
never realized that the html:form/ tag would do this (instantiate an
ActionForm and call reset) - I've always been under the impression that the
ActionForm, reset, and validate methods were not called until AFTER the form
was submitted.

Learning something new everyday . 8-)

Thanks.

Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

[EMAIL PROTECTED]


-Original Message-
From: Ted Husted [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 6:56 AM
To: Struts Users Mailing List
Subject: Re: ActionForm 'reset' method being called when JSP is rendered


In Struts 1.0.2 and later, reset is called by the html:form tag *if* the 
ActionForm is being instantiated at that time. The scope shouldn't matter.

Also remember that the html:form tag is looking at the Action to which 
it submits, which may not be Action 1. If these are the same Action, 
or share the same formbean under the same attribute, then the ActionForm 
should already exist, and reset should not be called.

-Ted.

Jerry Jalenak wrote:
 I'm seeing some odd behaviour with one of my actions.  If anyone can
explain
 this I'd sure appreciate it
 
 Here's what I've got - in struts-config I have an ActionForm that is
shared
 by two Actions.  The ActionForm is created in session scope by the first
 action, and referenced by the second Action (also in session).  Tracing
the
 calls to 'reset' and 'validate' I see the following:
 
   JSP is displayed  - html form is submitted - 'reset' is called -
 'validate' is called - Action 1 is performed - forward to next JSP -
 'reset' is called - JSP is displayed
   
 /\/\/\/\/\/\/\ !
 
 My understanding is that 'reset' should not be called again until the form
 on the second JSP is submitted.  Have I completely mis-understood how this
 works?  Or is it something due to the ActionForm being created in session
 scope?
 
 TIA!
 
 Jerry Jalenak
 Team Lead, Web Publishing
 LabOne, Inc.
 10101 Renner Blvd.
 Lenexa, KS  66219
 (913) 577-1496
 
 [EMAIL PROTECTED]
 
 
 This transmission (and any information attached to it) may be confidential
and is intended solely for the use of the individual or entity to which it
is addressed. If you are not the intended recipient or the person
responsible for delivering the transmission to the intended recipient, be
advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is
strictly prohibited. If you have received this transmission in error, please
immediately notify LabOne at the following email address:
[EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
Ted Husted,
Struts in Action http://husted.com/struts/book.html



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ActionForm 'reset' method being called when JSP is rendered

2003-06-19 Thread Paul Harrison
I am writing an application with a series of wizard type pages, so I 
thought that I would use one big ActionForm in session scope and each 
page add extra information to it - however this did not work as reset 
was being called at each page invocation - I am interested to hear that 
reset should only be called at instantiation time, because I believe 
that in 1.1 RC2 it is being called more often  than that - I can did out 
the old verision of the code to have a look at the exact circumstances 
if necessary

Ted Husted wrote:

In Struts 1.0.2 and later, reset is called by the html:form tag *if* 
the ActionForm is being instantiated at that time. The scope shouldn't 
matter.

Also remember that the html:form tag is looking at the Action to which 
it submits, which may not be Action 1. If these are the same Action, 
or share the same formbean under the same attribute, then the 
ActionForm should already exist, and reset should not be called.

-Ted.

Jerry Jalenak wrote:

I'm seeing some odd behaviour with one of my actions.  If anyone can 
explain
this I'd sure appreciate it

Here's what I've got - in struts-config I have an ActionForm that is 
shared
by two Actions.  The ActionForm is created in session scope by the first
action, and referenced by the second Action (also in session).  
Tracing the
calls to 'reset' and 'validate' I see the following:

JSP is displayed  - html form is submitted - 'reset' is called -
'validate' is called - Action 1 is performed - forward to next JSP -
'reset' is called - JSP is displayed

/\/\/\/\/\/\/\ !

My understanding is that 'reset' should not be called again until the 
form
on the second JSP is submitted.  Have I completely mis-understood how 
this
works?  Or is it something due to the ActionForm being created in 
session
scope?

TIA!

Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496
[EMAIL PROTECTED]

This transmission (and any information attached to it) may be 
confidential and is intended solely for the use of the individual or 
entity to which it is addressed. If you are not the intended 
recipient or the person responsible for delivering the transmission 
to the intended recipient, be advised that you have received this 
transmission in error and that any use, dissemination, forwarding, 
printing, or copying of this information is strictly prohibited. If 
you have received this transmission in error, please immediately 
notify LabOne at the following email address: 
[EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Paul Harrison
[EMAIL PROTECTED]
tel: 0161 428 2794
mob: 07904025192


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: ActionForm 'reset' method being called when JSP is rendered

2003-06-19 Thread Richard J. Duncan
If what your saying is true, it would break a *lot* of applications that create/reuse 
an ActionForm in a particular scope and then forward to a page. I wonder if something 
else is happening in your app. Just a thought...

Regards,
 
Rich

-Original Message-
From: Paul Harrison [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 19, 2003 11:43 AM
To: Struts Users Mailing List
Subject: Re: ActionForm 'reset' method being called when JSP is rendered

I am writing an application with a series of wizard type pages, so I 
thought that I would use one big ActionForm in session scope and each 
page add extra information to it - however this did not work as reset 
was being called at each page invocation - I am interested to hear that 
reset should only be called at instantiation time, because I believe 
that in 1.1 RC2 it is being called more often  than that - I can did out 
the old verision of the code to have a look at the exact circumstances 
if necessary

Ted Husted wrote:

 In Struts 1.0.2 and later, reset is called by the html:form tag *if* 
 the ActionForm is being instantiated at that time. The scope shouldn't 
 matter.

 Also remember that the html:form tag is looking at the Action to which 
 it submits, which may not be Action 1. If these are the same Action, 
 or share the same formbean under the same attribute, then the 
 ActionForm should already exist, and reset should not be called.

 -Ted.

 Jerry Jalenak wrote:

 I'm seeing some odd behaviour with one of my actions.  If anyone can 
 explain
 this I'd sure appreciate it

 Here's what I've got - in struts-config I have an ActionForm that is 
 shared
 by two Actions.  The ActionForm is created in session scope by the first
 action, and referenced by the second Action (also in session).  
 Tracing the
 calls to 'reset' and 'validate' I see the following:

 JSP is displayed  - html form is submitted - 'reset' is called -
 'validate' is called - Action 1 is performed - forward to next JSP -
 'reset' is called - JSP is displayed
 
 /\/\/\/\/\/\/\ !

 My understanding is that 'reset' should not be called again until the 
 form
 on the second JSP is submitted.  Have I completely mis-understood how 
 this
 works?  Or is it something due to the ActionForm being created in 
 session
 scope?

 TIA!

 Jerry Jalenak
 Team Lead, Web Publishing
 LabOne, Inc.
 10101 Renner Blvd.
 Lenexa, KS  66219
 (913) 577-1496

 [EMAIL PROTECTED]


 This transmission (and any information attached to it) may be 
 confidential and is intended solely for the use of the individual or 
 entity to which it is addressed. If you are not the intended 
 recipient or the person responsible for delivering the transmission 
 to the intended recipient, be advised that you have received this 
 transmission in error and that any use, dissemination, forwarding, 
 printing, or copying of this information is strictly prohibited. If 
 you have received this transmission in error, please immediately 
 notify LabOne at the following email address: 
 [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
Paul Harrison

[EMAIL PROTECTED]
tel: 0161 428 2794
mob: 07904025192



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ActionForm 'reset' method being called when JSP is rendered

2003-06-19 Thread Jerry Jalenak
Actually I am starting to think this is appropriate behaviour.  After I sent
the original e-mail I realized that the ActionForm was NOT being
instantiated by Action1; in struts-config Action1 simply pre-populated some
beans and then forwarded to JSP2.  It was when JSP2 was being rendered that
I was seeing the 'reset' method for the ActionForm being called.  Diving
into the FormTag code, I found the following:

public int doStartTag() throws JspException {

// Look up the form bean name, scope, and type if necessary
this.lookup();

// Create an appropriate form element based on our parameters
StringBuffer results = new StringBuffer();

results.append(this.renderFormStartElement());

results.append(this.renderToken());

ResponseUtils.write(pageContext, results.toString());

// Store this tag itself as a page attribute
pageContext.setAttribute(Constants.FORM_KEY, this,
PageContext.REQUEST_SCOPE);

this.initFormBean();

return (EVAL_BODY_INCLUDE);

}

/**
 * Locate or create the bean associated with our form.
 * @throws JspException
 * @since Struts 1.1
 */
protected void initFormBean() throws JspException {
int scope = PageContext.SESSION_SCOPE;
if (request.equalsIgnoreCase(beanScope)) {
scope = PageContext.REQUEST_SCOPE;
}

Object bean = pageContext.getAttribute(beanName, scope);
if (bean == null) {
if (type != null) {
// Backwards compatibility - use explicitly specified values
try {
bean = RequestUtils.applicationInstance(beanType);
if (bean != null) {
((ActionForm) bean).setServlet(servlet);
}
} catch (Exception e) {
throw new JspException(
messages.getMessage(formTag.create, type,
e.toString()));
}
} else {
// New and improved - use the values from the action mapping
bean =
RequestUtils.createActionForm(
(HttpServletRequest) pageContext.getRequest(),
mapping,
moduleConfig,
servlet);
}
if (bean instanceof ActionForm) {
((ActionForm) bean).reset(mapping, (HttpServletRequest)
pageContext.getRequest());
}
if (bean == null) {
throw new JspException(messages.getMessage(formTag.create,
beanType));
}
pageContext.setAttribute(beanName, bean, scope);
}
pageContext.setAttribute(Constants.BEAN_KEY, bean,
PageContext.REQUEST_SCOPE);
}

The doStartTag has a call to initFormBean; in initFormBean there is a call
to RequestUtils.createActionForm, followed by a call to the ActionForms
'reset' method.  In a wizard type of application, this could indeed cause
problems where the reset method may be clearing values from the ActionForm;
I've had to add code to a couple of my projects to check the mapping to see
if I wanted to reset or not.  Maybe one of the guru's could shed some light
on why the html:form/ tag would instantiate the ActionForm and call reset
when the JSP is rendered, opposed to doing this when the form is actually
submitted



Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

[EMAIL PROTECTED]


-Original Message-
From: Richard J. Duncan [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 19, 2003 12:00 PM
To: [EMAIL PROTECTED]
Subject: RE: ActionForm 'reset' method being called when JSP is rendered


If what your saying is true, it would break a *lot* of applications that
create/reuse an ActionForm in a particular scope and then forward to a page.
I wonder if something else is happening in your app. Just a thought...

Regards,
 
Rich

-Original Message-
From: Paul Harrison [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 19, 2003 11:43 AM
To: Struts Users Mailing List
Subject: Re: ActionForm 'reset' method being called when JSP is rendered

I am writing an application with a series of wizard type pages, so I 
thought that I would use one big ActionForm in session scope and each 
page add extra information to it - however this did not work as reset 
was being called at each page invocation - I am interested to hear that 
reset should only be called at instantiation time, because I believe 
that in 1.1 RC2 it is being called more often  than that - I can did out 
the old verision of the code to have a look at the exact circumstances 
if necessary

Ted Husted wrote:

 In Struts 1.0.2 and later, reset is called by the html:form tag *if* 
 the ActionForm is being instantiated at that time. The scope shouldn't 
 matter.

 Also remember that the html:form tag is looking

Re: ActionForm 'reset' method being called when JSP is rendered

2003-06-19 Thread Paul Harrison
I have looked at this again, and in 1.1 rc2 on tomcat 4.1.18 the reset 
is called for each action of a multi action sequence sharing a form bean 
even though the form bean is in session scope and only created once - I 
have written a demo app with logging that shows this behaviour - should 
I submit a bug if this is not what is intended to happen.

Paul.

Paul Harrison wrote:

I am writing an application with a series of wizard type pages, so I 
thought that I would use one big ActionForm in session scope and each 
page add extra information to it - however this did not work as reset 
was being called at each page invocation - I am interested to hear 
that reset should only be called at instantiation time, because I 
believe that in 1.1 RC2 it is being called more often  than that - I 
can did out the old verision of the code to have a look at the exact 
circumstances if necessary

Ted Husted wrote:

In Struts 1.0.2 and later, reset is called by the html:form tag *if* 
the ActionForm is being instantiated at that time. The scope 
shouldn't matter.

Also remember that the html:form tag is looking at the Action to 
which it submits, which may not be Action 1. If these are the same 
Action, or share the same formbean under the same attribute, then the 
ActionForm should already exist, and reset should not be called.

-Ted.

Jerry Jalenak wrote:

I'm seeing some odd behaviour with one of my actions.  If anyone can 
explain
this I'd sure appreciate it

Here's what I've got - in struts-config I have an ActionForm that is 
shared
by two Actions.  The ActionForm is created in session scope by the 
first
action, and referenced by the second Action (also in session).  
Tracing the
calls to 'reset' and 'validate' I see the following:

JSP is displayed  - html form is submitted - 'reset' is called -
'validate' is called - Action 1 is performed - forward to next JSP -
'reset' is called - JSP is displayed
/\/\/\/\/\/\/\ !
My understanding is that 'reset' should not be called again until 
the form
on the second JSP is submitted.  Have I completely mis-understood 
how this
works?  Or is it something due to the ActionForm being created in 
session
scope?

TIA!

Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496
[EMAIL PROTECTED]

This transmission (and any information attached to it) may be 
confidential and is intended solely for the use of the individual or 
entity to which it is addressed. If you are not the intended 
recipient or the person responsible for delivering the transmission 
to the intended recipient, be advised that you have received this 
transmission in error and that any use, dissemination, forwarding, 
printing, or copying of this information is strictly prohibited. If 
you have received this transmission in error, please immediately 
notify LabOne at the following email address: 
[EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Paul Harrison
[EMAIL PROTECTED]
tel: 0161 428 2794
mob: 07904025192


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: ActionForm 'reset' method being called when JSP is rendered

2003-06-19 Thread Craig R. McClanahan


On Thu, 19 Jun 2003, Paul Harrison wrote:

 Date: Thu, 19 Jun 2003 23:29:32 +0100
 From: Paul Harrison [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED],
  [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: ActionForm 'reset' method being called when JSP is rendered

 I have looked at this again, and in 1.1 rc2 on tomcat 4.1.18 the reset
 is called for each action of a multi action sequence sharing a form bean
 even though the form bean is in session scope and only created once - I
 have written a demo app with logging that shows this behaviour - should
 I submit a bug if this is not what is intended to happen.


The behavior you describe is precisely the intended behavior -- otherwise
things like checkboxes on the individual pages would still not work.  In
general, you'll want to make your reset() method smart about which
properties it resets, depending on what the current page is.

 Paul.


Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ActionForm 'reset' method being called when JSP is rendered

2003-06-18 Thread Jing Zhou

- Original Message - 
From: Jerry Jalenak [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 9:04 AM
Subject: ActionForm 'reset' method being called when JSP is rendered


 I'm seeing some odd behaviour with one of my actions.  If anyone can
explain
 this I'd sure appreciate it

 Here's what I've got - in struts-config I have an ActionForm that is
shared
 by two Actions.  The ActionForm is created in session scope by the first
 action, and referenced by the second Action (also in session).  Tracing
the
 calls to 'reset' and 'validate' I see the following:

 JSP is displayed  - html form is submitted - 'reset' is called -
 'validate' is called - Action 1 is performed - forward to next JSP -
 'reset' is called - JSP is displayed

 /\/\/\/\/\/\/\ !

 My understanding is that 'reset' should not be called again until the form
 on the second JSP is submitted.  Have I completely mis-understood how this
 works?  Or is it something due to the ActionForm being created in session
 scope?

Your understanding is correct. There might be some configuration errors if
you
check: 1) Make sure the second action mapping requires a session scoped
form bean; 2) The form bean name and action mapping attribute in the
second action mapping agree with ones in the first action mapping.

Jing


 TIA!

 Jerry Jalenak
 Team Lead, Web Publishing
 LabOne, Inc.
 10101 Renner Blvd.
 Lenexa, KS  66219
 (913) 577-1496

 [EMAIL PROTECTED]


 This transmission (and any information attached to it) may be confidential
and is intended solely for the use of the individual or entity to which it
is addressed. If you are not the intended recipient or the person
responsible for delivering the transmission to the intended recipient, be
advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is
strictly prohibited. If you have received this transmission in error, please
immediately notify LabOne at the following email address:
[EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]