NotSerializableException using FormFile

2003-10-06 Thread Marc Dugger
I've set the scope of my form to 'session' to support a "wizard" process.
The form defines a property of type org.apache.struts.upload.FormFile.  This
work fine until I set 'validate = true' on my action mapping.  It appears
that org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile
does not implement Serializable.  Has anyone run into this and what did you
do to get around it?  Thanks in advance.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/2003


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



RE: NotSerializableException using FormFile [SOLUTION]

2003-10-09 Thread Marc Dugger
1.  Create custom MultipartRequestHandler
("MyCustomMultipartRequestHandler") by extending
org.apache.struts.upload.CommonsMultipartRequestHandler.
2.  Create inner, private class in MyCustomMultipartRequestHandler that
implements FormFile and Serializable.  I simple copied all the methods from
the inner class CommonsFormFile in CommonsMultipartRequestHandler.
3.  Override addFileParameter(FileItem item) in
MyCustomMultipartRequestHandler to use your custom handler:
protected void addFileParameter(FileItem item) {
FormFile formFile = new MyCustomMultipartRequestHandler(item);

getFileElements().put(item.getFieldName(), formFile);
getAllElements().put(item.getFieldName(), formFile);
}
4.  Add new 'controller' entry in struts-config.xml:



> -Original Message-----
> From: Marc Dugger [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 06, 2003 1:49 PM
> To: [EMAIL PROTECTED]
> Subject: NotSerializableException using FormFile
>
>
> I've set the scope of my form to 'session' to support a "wizard" process.
> The form defines a property of type
> org.apache.struts.upload.FormFile.  This
> work fine until I set 'validate = true' on my action mapping.  It appears
> that
> org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile
> does not implement Serializable.  Has anyone run into this and
> what did you
> do to get around it?  Thanks in advance.
> ---
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/2003


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



contains(String, String) in DynaActionForm

2003-10-09 Thread Marc Dugger
Can someone explain the parameters of this method?  The javadocs call them
'name' and 'key'.  I gather that 'name' refers to the 'name' attribute of
the  in struts-config.  If so, what does 'key' refer to?
Thanks.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 9/29/2003


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



only Strings appear to be validated by Validator

2003-10-16 Thread Marc Dugger
My validation.xml:








test
((noteScheduleTypeId != 5) or (*this* !=
null))



















...I'm only receiving validation errors for 'Name' and 'Description'.  Has
anyone experienced this?  Thanks in advance.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003


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



RE: only Strings appear to be validated by Validator [SOLUTION]

2003-10-16 Thread Marc Dugger
My bad...you're right...it does work.  Thanks to the miracle of logging, I
realized that the integers were being defaulted to zero.  As a result, they
were in fact passing the validation tests.  Only when I applied 'intRange'
did the app catch invalids.  Thanks!



> -Original Message-
> From: Barry Volpe [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 16, 2003 5:09 PM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: Re: only Strings appear to be validated by Validator
>
>
> I only have experience using the following in my validator.xml:
>
>  depends="required,integer">
> 
>
>  depends="required,float">
> 
>
>
>   integer and float are in the validator-rules.xml
>
> They do work.
>
> The struts-validator.war in the struts 1.1 release uses this in
> the example
>
> Barry
>
>
> - Original Message -
> From: "Marc Dugger" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, October 16, 2003 2:42 PM
> Subject: only Strings appear to be validated by Validator
>
>
> > My validation.xml:
> >
> > 
> >  depends="required,integer">
> > 
> > 
> >  > depends="validwhen,integer">
> > 
> > 
> > test
> > ((noteScheduleTypeId != 5) or (*this* !=
> > null))
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > ...I'm only receiving validation errors for 'Name' and
> 'Description'.  Has
> > anyone experienced this?  Thanks in advance.
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
> >
> >
> > -
> > 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]
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003


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



repopulating options of when validation fails

2003-10-17 Thread Marc Dugger
Can anyone offer a crafty method of reloading a dynamic collection of
 into the request scope in case form validation fails and the
controller must forward to the 'input' of the action mapping?  Thanks.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003


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



populating form fields from request params

2003-10-18 Thread Marc Dugger
I am using the same form to both create and update database entities.  The
following is an example of a form field:





And from my struts-config.xml:


  
  
... yada, yada, yada ...


As you can see, if this field changes the page is reloaded.  Problem:  if
${note.auditIdentity} returns null (which would be the case if I was
creating a new entity) the property is not being populated from form bean.
How do I specify that if value is , populate from form bean's
property?
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003


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



RE: populating form fields from request params

2003-10-18 Thread Marc Dugger
I thought I could resolve this by specifiying:

 value='${true ? param.documentStatusTypeId :
note.auditIdentity.documentStatusType.id}'

...but this did not work.  Is the ternary operator not supported yet in
struts-el?  (I'm using struts-el-1.1.jar)



> -Original Message-
> From: Martin Gainty [mailto:[EMAIL PROTECTED]
> Sent: Saturday, October 18, 2003 1:25 PM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: Re: populating form fields from request params
>
>
> check out
> http://jakarta.apache.org/struts/userGuide/struts-html.html#options
>
> (I wouldnt use collection in this case..I assume we are returning scalar
> entity)
> to paraphrase
> "where  collection of values actually selected depends on the presence or
> absence of the name and property attributes"
> the name or property being null can be tested and value assigned can be
> ascertained.
> Keep me informed,
> -Martin
> - Original Message -
> From: "Marc Dugger" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, October 18, 2003 12:35 PM
> Subject: populating form fields from request params
>
>
> > I am using the same form to both create and update database
> entities.  The
> > following is an example of a form field:
> >
> >  > value='${note.auditIdentity.documentStatusType.id}'
> > onchange="editNoteForm.action=''; editNoteForm.submit(); return true;">
> >  > property='id' labelProperty='name' />
> > 
> >
> > And from my struts-config.xml:
> >
> >  > type="org.apache.struts.validator.DynaValidatorForm" dynamic="true">
> >   
> >> type="java.lang.Integer" />
> > ... yada, yada, yada ...
> > 
> >
> > As you can see, if this field changes the page is reloaded.
> Problem:  if
> > ${note.auditIdentity} returns null (which would be the case if I was
> > creating a new entity) the property is not being populated from
> form bean.
> > How do I specify that if value is , populate from form bean's
> > property?
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
> >
> >
> > -
> > 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]
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003


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



RE: "could not deserialize the context attribute .. " (configuration: struts 1.1 + web logic 8.1), is it a known bug ?

2003-10-19 Thread Marc Dugger
I had a somewhat similar issue with Tomcat when it came to serializing a
FormFile.  I got around this by extending the MultipartRequestHandler and
implementing Serializable.  It appears that you could do the same with the
RequestProcessor.  Be sure to add this to your struts-config.xml:




> -Original Message-
> From: Shay Cohen [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 19, 2003 3:17 AM
> To: '[EMAIL PROTECTED]'
> Subject: "could not deserialize the context attribute .. "
> (configuration: struts 1.1 + web logic 8.1), is it a known bug ?
>
>
> Hi,
>
> I've encountered lately the following exception "Could not deserialize
> context attribute". Reported on the following attribute:
>
>
> Attribute: org.apache.struts.action.REQUEST_PROCESSOR (object:
> org.apache.struts.tiles.TilesRequestProcessor)
>
> After reading old emails concerning the subject, I've learned that this is
> due to weblogic restrictions that require context attributes to be
> serializable.
>
>
> Is there any workaround to this problem? will it be solved  ?
>
> -
> 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]



Validator error (Struts nightly build)

2003-10-19 Thread Marc Dugger
I'm receiving the following exception:

line 1:30: unexpected char: '0'
at
org.apache.struts.validator.validwhen.ValidWhenLexer.nextToken(ValidWhenLexe
r.java:236)
at antlr.TokenBuffer.fill(TokenBuffer.java:69)
at antlr.TokenBuffer.LA(TokenBuffer.java:80)
at antlr.LLkParser.LA(LLkParser.java:52)
at
org.apache.struts.validator.validwhen.ValidWhenParser.value(ValidWhenParser.
java:384)
  ...etc. etc.

I think the following in my validation.xml is causing it
(prepaymentPenaltyClause is an 'Integer' field in the DynaValidationForm):




  test
  ((prepaymentPenaltyClause != 0) and (*this* !=
null))



Am I using 'validwhen' correctly here?  Thanks.



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



RE: Bug tracking software

2003-10-20 Thread Marc Dugger
Scarab is Java based and quite easy to set up.

> -Original Message-
> From: Jeff Kyser [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 20, 2003 4:43 PM
> To: Struts Users Mailing List
> Subject: Re: Bug tracking software
> 
> 
> I have used GNATS and gnatsweb for years and like them very much
> but they are not Java. gnatsweb is a cgi script written in PERL and I
> don't know or care what GNATS is written in as it *just works*.
> 
> -jeff
> 
> On Monday, October 20, 2003, at 04:30  PM, Srinivas Gunturu wrote:
> 
> > Is there any web based open source/free bug tracking software 
> > available?  We are using struts, but it doesn't have to be struts 
> > based as long as it is Java. :-)
> >
> > Thanks
> >
> >
> > -
> > 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]

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



not printing all ActionMessages

2003-10-21 Thread Marc Dugger




I'm only seeing one ActionMessage printed out.  I thought 
would iterate, but apparently not.  Can someone provide some guidance?
Thanks.


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



FW: not printing all ActionMessages (CORRECTED)

2003-10-21 Thread Marc Dugger
should read  below


-Original Message-
From: Marc Dugger [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 6:37 AM
To: [EMAIL PROTECTED]
Subject: not printing all ActionMessages






I'm only seeing one ActionMessage printed out.  I thought 
would iterate, but apparently not.  Can someone provide some guidance?
Thanks.


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



RE: not printing all ActionMessages

2003-10-21 Thread Marc Dugger
Yes, that was a typo on my part as a result of trying alternative attributes
and valuesit reads  when only printing 1
ActionMessage.  Also, I'm sure I have more because I see the messages being
added to the resource bundle in my logs.


> -Original Message-
> From: Ravi Kulkarni [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 21, 2003 6:39 AM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: RE: not printing all ActionMessages
>
>
> I think  should be  name='messages'
> />
>
> -Original Message-
> From: Marc Dugger [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 21, 2003 5:07 PM
> To: [EMAIL PROTECTED]
> Subject: not printing all ActionMessages
>
>
>  footer='messages.footer'>
> 
> 
>
> I'm only seeing one ActionMessage printed out.  I thought 
> would iterate, but apparently not.  Can someone provide some guidance?
> Thanks.
>
>
> -
> 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]


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



RE: Display Mode | Edit Mode

2003-10-22 Thread Marc Dugger
It's not so much a feature as the way you design your Action and ActionForm.
I do this with all JSP responsible for creating/editing some persistent
business object.  What I do:

1.  Create two actions named Get[YourBusinessObject]Action and
Edit[YourBusinessObject]Action.  Both should extends DispatchAction.
2.  Create two mappings in your struts-config:  /yourbizobj/get and
/yourbizobject/edit.  Set 'validate' to true on /yourbizobject/edit and
define a 'parameter' attribute on each action mapping (i.e.
parameter="mode").
3.  Create a form-bean entry in struts-config with the necessary properties.
4.  Implement two methods in each Action:  add and update.  The 'add' on
Get[YourBusinessObject]Action is called to do any initialization before
return a blank form to the user (i.e. /yourbizobject/get?mode=add).  The
'update' on Get[YourBusinessObject]Action is used to retrieve the business
object from persistent storage and populate the ActionForm with property
values (i.e. /yourbizobject/get?mode=update).  The 'add' on
Edit[YourBusinessObject]Action is used to insert a new business object into
persistent storage (i.e. /yourbizobject/edit?mode=add) while the 'update'
used to update an already existing business object in persistent storage
(i.e. /yourbizobject/get?mode=update).


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 22, 2003 12:19 AM
> To: [EMAIL PROTECTED]
> Subject: Display Mode | Edit Mode
>
>
> Does STRUTS provide any feature so that the same jsp can be used for
> showing the page in Display Mode as well as Edit Mode without having to
> manually code the same in JSP ?
>
> Regards
> Sreekant G
> @ 98404-65630
>
>
>


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



RE: requiredif

2003-10-27 Thread Marc Dugger
My understanding is that 'requiredif' will be deprecated and the use of
'validwhen' is encouraged.

Example:


  

  test
  ((sendNewsletter == null) or (*this* !=
null))

  


> -Original Message-
> From: Rhet Behler [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 27, 2003 5:47 PM
> To: Struts Users Mailing List
> Subject: requiredif
>
>
> Has anyone used this in the validation.xml?
>
> If so could I see a simple example?
>
> If not what are you using validwhen?
>
> thanks


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



RE: requiredif

2003-10-27 Thread Marc Dugger
"The new validwhen validation rule, which will be included into the Struts
release immediately after the 1.1 release..."

I am using the nightly build to develop my app and am hoping 1.2 will be
release by the time I'm ready to deploy.  So far, validwhen is operating as
promised.  I haven't run into any problems, but you may search the archives
to view other opinions.


> -Original Message-
> From: Rhet Behler [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 27, 2003 7:17 PM
> To: Struts Users Mailing List
> Subject: Re: requiredif
>
>
> validwhen isn't available in struts 1.1 is it?
>
> have you used this or tested it?
>
>
> - Original Message -
> From: "Marc Dugger" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, October 27, 2003 5:32 PM
> Subject: RE: requiredif
>
>
> > My understanding is that 'requiredif' will be deprecated and the use of
> > 'validwhen' is encouraged.
> >
> > Example:
> >
> > 
> >   
> > 
> >   test
> >   ((sendNewsletter == null) or (*this* !=
> > null))
> > 
> >   
> >
> >
> > > -Original Message-
> > > From: Rhet Behler [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, October 27, 2003 5:47 PM
> > > To: Struts Users Mailing List
> > > Subject: requiredif
> > >
> > >
> > > Has anyone used this in the validation.xml?
> > >
> > > If so could I see a simple example?
> > >
> > > If not what are you using validwhen?
> > >
> > > thanks
> >
> >
> > -
> > 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]


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



RE: validwhen + struts 1.1

2003-11-06 Thread Marc Dugger
Blank"validwhen" is in CVS right now.  Check out nightly build if it's worth
it to you.

  -Original Message-
  From: Vara Prasad Reddy [mailto:[EMAIL PROTECTED]
  Sent: Thursday, November 06, 2003 5:32 AM
  To: struts
  Subject: validwhen + struts 1.1
  Importance: High


  I am currently using struts 1.1. Is there a way I can use the "validwhen"
functionality of future coming struts 1.2.

  Something like I can take only the class files of validwhen and use it
along with struts 1.1

  can someone detail me on this?

  Thanks in advance
  Vara Prasad


ValidatorForm losing params when validation fails

2003-11-09 Thread Marc Dugger
The following code fragment is used in a DispatchAction and when the
validation fails, the input form is returned unpopulated because all my form
fields lose the data that was originally sent with the request:

ActionErrors errors = form.validate(mapping, request);
if (!errors.isEmpty()) {
saveMessages(request, errors);
return mapping.getInputForward();
}

My form extends ValidatorForm and I have not overridden reset().  Why is the
form losing it's parameters?  Thanks in advance.


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



RE: ValidatorForm losing params when validation fails

2003-11-10 Thread Marc Dugger
My mapping specifies 'validate="false"' because I have a method in the
DispatchAction, called refresh(mapping, form, request, response) which
adjusts the size of indexed properties in the Form and returns the user to
the same page.  I do not want the form to be validated when refresh(mapping,
form, request, response) is called, but I do want validation when the other
methods (i.e. add, update) on the DispatchAction are called.  Make sense?

> -Original Message-
> From: Nimish Chourey , Tidel Park - Chennai
> [mailto:[EMAIL PROTECTED]
> Sent: Sunday, November 09, 2003 10:50 PM
> To: Struts Users Mailing List
> Subject: RE: ValidatorForm losing params when validation fails
>
>
> The validate method of the form would be called before the
> execute method of
> action ..
> Why do you have to call the form.validate(mapping, request) explicitly , I
> doth think this code in acton would be executed if the validation
> fails ...
>
>
> -Original Message-
> From: Marc Dugger [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 10, 2003 6:45 AM
> To: [EMAIL PROTECTED]
> Subject: ValidatorForm losing params when validation fails
>
>
> The following code fragment is used in a DispatchAction and when the
> validation fails, the input form is returned unpopulated because
> all my form
> fields lose the data that was originally sent with the request:
>
> ActionErrors errors = form.validate(mapping, request);
>   if (!errors.isEmpty()) {
>   saveMessages(request, errors);
>   return mapping.getInputForward();
>   }
>
> My form extends ValidatorForm and I have not overridden reset().
> Why is the
> form losing it's parameters?  Thanks in advance.
>
>
> -
> 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: ValidatorForm losing params when validation fails

2003-11-10 Thread Marc Dugger


















> -Original Message-
> From: Nimish Chourey , Tidel Park - Chennai
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 10, 2003 6:21 AM
> To: Struts Users Mailing List
> Subject: RE: ValidatorForm losing params when validation fails
>
>
> Yes .. It makes sense ..
>
> Can u post the action mapping in the struts config .. That may give some
> clue
>
> -Original Message-
> From: Marc Dugger [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 10, 2003 5:33 PM
> To: Struts Users Mailing List
> Subject: RE: ValidatorForm losing params when validation fails
>
>
> My mapping specifies 'validate="false"' because I have a method in the
> DispatchAction, called refresh(mapping, form, request, response) which
> adjusts the size of indexed properties in the Form and returns the user to
> the same page.  I do not want the form to be validated when
> refresh(mapping,
> form, request, response) is called, but I do want validation when
> the other
> methods (i.e. add, update) on the DispatchAction are called.  Make sense?
>
> > -Original Message-
> > From: Nimish Chourey , Tidel Park - Chennai
> > [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, November 09, 2003 10:50 PM
> > To: Struts Users Mailing List
> > Subject: RE: ValidatorForm losing params when validation fails
> >
> >
> > The validate method of the form would be called before the execute
> > method of action ..
> > Why do you have to call the form.validate(mapping, request)
> explicitly , I
> > doth think this code in acton would be executed if the validation
> > fails ...
> >
> >
> > -Original Message-
> > From: Marc Dugger [mailto:[EMAIL PROTECTED]
> > Sent: Monday, November 10, 2003 6:45 AM
> > To: [EMAIL PROTECTED]
> > Subject: ValidatorForm losing params when validation fails
> >
> >
> > The following code fragment is used in a DispatchAction and when the
> > validation fails, the input form is returned unpopulated because all
> > my form fields lose the data that was originally sent with the
> > request:
> >
> > ActionErrors errors = form.validate(mapping, request);
> > if (!errors.isEmpty()) {
> > saveMessages(request, errors);
> > return mapping.getInputForward();
> > }
> >
> > My form extends ValidatorForm and I have not overridden reset(). Why
> > is the form losing it's parameters?  Thanks in advance.
> >
> >
> > -
> > 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]
>


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



dynamic indexed properties in Form bean

2003-11-10 Thread Marc Dugger
I'm having trouble populating a Form bean that has an indexed (variable
size) nested bean.  I'm using an ArrayList inside the Form bean to collect
the nested properties and it's partially working.  The problem is that
because the index is variable, I don't know how to correctly size the
ArrayList.  As a result, the nested beans are being accessed by their index
inconsistently.I'm trying to dynamically grow it as getBean(int idx) is
called, but it's messy.  Does anyone have a good solution for this?  Thanks
in advance.

JSP:



























Bean fragment:

public class LiabilityForm extends ValidatorForm implements MonthlyDebts,
DispatchForm {

private ArrayList borrowerLiability = new ArrayList();
... more properties...

public BorrowerLiability[] getBorrowerLiability() {
return (BorrowerLiability[]) this.borrowerLiability.toArray(new
BorrowerLiability[0]);
}
public BorrowerLiabilityImpl getBorrowerLiability(int idx) {
BorrowerLiabilityImpl bl;
if (borrowerLiability.size() <= idx) {
borrowerLiability.ensureCapacity(idx+1);
bl = new BorrowerLiabilityImpl();
borrowerLiability.add(bl);
} else
bl = (BorrowerLiabilityImpl) borrowerLiability.get(idx);
return bl;
}
...more method ...
}


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