Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
DTOInForm
StrutsResumeSupport




JSPWiki v2.2.33

[RSS]


Hide Menu

POJOsToForms


Difference between version 23 and version 3:

At line 3 changed 1 line.
__Send your POJOs to the UI rather than converting them to ActionForms first.__
__Send your [POJO]s to the UI rather than converting them to ActionForms first.__
At line 7 changed 1 line.
The issue I'm seeing right now with lazily-loaded properties is that they're loaded when using BeanUtils.copyProperties() is called. I use this to convert POJOs to ActionForms, and consequently 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 (rather than by a 3rd party conversion utility). 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.
The issue I'm seeing right now with lazily-loaded properties is that they're loaded when using BeanUtils.copyProperties() is called. I use this to convert POJOs to ActionForms, and consequently 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 (rather than by a 3rd party conversion utility). 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|http://hibernate.bluemars.net/43.html], those lazy collections are still available while the JSP is being rendered.
At line 12 added 19 lines.
''You might also be interested in [my blog entry on the subject|http://www.raibledesigns.com/page/rd/20030619#sending_pojos_to_the_ui].''
''Are you saying that you would populate the form manually in the view?'' ~ [mojavelinux]
I suggest looking at Struts' __Nested__ taglib. It does set properties if complex DTO objects
and does not require (semi)manual conversion between strings and actual data types.
With little wrapper to BeanUtilities, which registers a Date handler with desired formatting pattern, it allows correct handling of dates.
__Related Pages:__
* [DTOInForm]
* [Nested Extension|http://keyboardmonkey.com/next/index.jsp]
__Comments:__
----
I know it's not really useful to you, but WebWork gives you this natively. It's one of the big differences between WW and Struts, in that with WebWork you can make true model-driven actions, and then use them in your form.
For example a form field called

Back to POJOsToForms, or to the Page History.