Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This is version 2.
It is not the current version, and thus it cannot be edited. This is from a discussion on the struts-user mailing list. I'm continuing it here because I want to propose a new idea: only converting ActionForms to POJOs. By this, I mean to say that I'd like to retrieve and display POJOs on the UI, and capture their information (as ActionForms) when saving the form. The reason I want to do this is because of Hibernate's Lazy Loading feature. Basically, Hibernate allows you to load children of an object, i.e. Resumes of a User, when the getResumes() method is called on User. When using BeanUtils.copyProperties() to convert a POJO to an ActionForm, the getResumes() method is called. However, I don't want this. I'd rather the getResumes() method is called when I call it in my code. Therefore, I'm thinking that passing the POJO to the view is the best solution. Because I'm using the open-session-in-view pattern, those lazy collections are still available while the JSP is being rendered. This solves another issue too. It's nice to format dates on the UI, and you need a real date on your form to do this, rather than a String value of a date that's already been converted. One issue might be with checkboxes, but I can just use the Form for that, right? I haven't tried this yet, but I wanted to write my thoughts down and stir up some discussion on it beforehand.
|