This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi All, Due to a not so good design(it seems to me), which is largely dependant on a legacy DBMS for data, my VOs are turning out to be somewhat larger. And I am required to present the data of 2-3 VOs together in a single form. Right now I'm having accessor properties for those VOs in the ActionForm. Just to illustrate my point ..
And in the JSP page, with the help of <bean efine> and <html:text> I'm laying out properties of these beans. This approach does not seem to be a very good solution to me. Any suggestions? Regards, Kinjal Sonpal
You shouldn't need to use the bean tag. You can reference your beans (VOs) in the property attribute of html:text. <html:text property="largeBean1.property1"/> This effectively calls getLargeBean1().getProperty1() for the getter and getLargeBean1().setProperty1() for the setter You can even refer to beans within beans... <html:text property="largeBean1.mediumBean1.smallBean1.tinyBean1.tinyBeanValue1"/>
A good workman is known by his tools.
Joined: Jun 06, 2003
Marc, thanks a lot for the suggestion. Actually, I'd misformed my question somewhat. My question is about having very large beans in the ActionForms itself. Which probably also means that such a large object would also be there in Session for quite some time, since the bean is required across requests. Should there be any change in the process to avoid large objects being stored in the session or should it be okay the way it is? Regards, Kinjal Sonpal
If anything I would put the beans in session and set the forms to request scope. I've read in multiple forums to never put forms in session unless it is absolutely necessary to do so. If you want to refactor your VOs it might be wise to separate it into which portions should have different lengths of persistence. If at a point in your application there is little chance that a portion will get used again (by the user clicking your 'Previous' buttons) then scrap it and make another call for it if it's needed. I get the feeling you are eager to modify it anyway. Remember, there's more than one way to Strut a cat (or any other container). If anyone else has input please give your 2cents.
Joined: Jun 06, 2003
Marc, Thanks a lot for your input. They were really valuable. As you said, I was earlier thinking on the lines of refactoring the beans. But now I think the code has progressed so much that it seems difficult to convince my PL. I'd rather follow the other path of not having my form in session and putting those beans in Session for reuse. Thanks and regards, Kinjal Sonpal