Issue Details (XML | Word | Printable)

Key: STR-2972
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Niall Pemberton
Reporter: Stuart Goldberg
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Struts 1

LazyValidatorForm cannot be saved in the session

Created: 08/Nov/06 03:03 PM   Updated: 04/Jul/07 03:36 AM
Component/s: Core
Affects Version/s: 1.3.5
Fix Version/s: 1.3.6

Environment: N/A

Flags: Important


 Description  « Hide
This issue relates to the Struts Bugzilla entry "ASF Bugzilla Bug 35488".

That fix makes it so that your forms can be resued if you use a POJO in a <form-bean> element that Strus will wrap in a BeanValidatorForm.

However it is still broken in the following scenario. Use LazyValidatorForm (or a subclass thereof) in a <form-bean> element. Your form will never be reused (or saved?) because FormBeanConfig will compare LazyValidatorForm against LazyDynaBean and always fail.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Niall Pemberton added a comment - 09/Nov/06 01:26 AM
Fixed in revision 472728, thanks for reporting this.

   http://svn.apache.org/viewvc?view=rev&revision=472728

If you need a workaround you could create your own FormBeanConfig implementation, modify it to correctly recognise session scoped LazyValidatorForm that can be reused and configure Struts to use your FormBeanConfig implementation.

This issue and the related bug STR-2507 could probably do with back-porting to the 1.2.x branch.

Niall

Stuart Goldberg added a comment - 12/Nov/06 11:13 PM
Thanks Niall,

I see from the Struts website that you are a committee member. Well, I now have my name is lights!

Anyway, my company uses Struts and was enhancing one of our project's code. I found the LazyValidatorForm to be very useful for what I wanted to do.

However, I would have prefered a flavor that doesn't seem to exist.

Here's the scenario, we have one of 4 forms that can put up as a web page. Each of the forms has a certain number of fields in common; the others vary from form to form. If this were modeled in OOP terms, you'd have an abstract form that has the common fields and subclasses that add their own.

I'm looking for a type of Struts form that, in part, looks like a POJO ActionForm with setters and getters, yet it would have a lazy component to it as well so that other fields could be added to it much like the LazyValidatorForm.

I'd like to be able to pull out the common information like this: myForm.getCommonProp1(), myForm.getCommonProp2(), etc. I'd like to reserve the lazy usage pattern (i.e. myForm.get("specialProp1") ) for the specialized properties. I tried to compose something like this using: LazyDynaBean, WrapDynaBean, subclassing, etc. All to no avail!

Do you see something useful in this? Perhaps I could write it and become a Contributer! Let me know.

- Stuart


Paul Benedict added a comment - 18/Nov/06 06:45 AM
Niall, If this is fixed, I would like to assign this to 1.3.6 and resolve it. Are you finished with it?

Niall Pemberton added a comment - 18/Nov/06 09:05 AM
Hi Paul,
resolving this as fixed.

Stuart,
in Struts 1.3 you can inherit "dyna" forms using the "extends" attribute - maybe that will meet your need? One possible issue with what you describe is how beanutils treats DynaBeans and POJO's - if its a DynaBean then any regular properties are ignored. Possiblly I have mis-understood - if you do come up with an alternative implementation that you want to share with others then by all means open a Jira ticket and submit it back.