• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

good pratice spring mvc

 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

i would like to know if there is a web site who list good pratice for spring 3.0?

i started a program, i splitted it with a controller, service and dao layer but i have some question about form objet used in the jsp...

i create a UserForm who is used in a jsp, this object look like



i don't know if a good pratice to put all theses information in a object.. or it's better to put all combobox value in a separate object...

example to feed listbox, there are some possibility... call many dao method in the service layer and feed a UserForm object...
or create one methode by list at the service layer and in the controller call all these method..

maybe it's better to create a object only for the listbox... use it a the service layer and controller layer...

at the controller layer, the choice will impact on the @ModelAttribute methode... one for the UserForm or one for every list or one for hypothetical listbox content object...

some basic question, but i prefer the good pratice now than later...

thanks
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally, I never create a separate Form Domain object, I like to use just the Domain objects I am using up and down the layers. So I will put Lists of values for combo boxes as separate objects I put into the Model.

Mark
 
mark smith
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark Spritzler wrote:Personally, I never create a separate Form Domain object, I like to use just the Domain objects I am using up and down the layers. So I will put Lists of values for combo boxes as separate objects I put into the Model.

Mark



ok so you put your list of value directely in the model.... and in the controller, you have a @ModelAttribute for every list .... before method.get and method.post the list will be feeded....

 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

mark smith wrote:

Mark Spritzler wrote:Personally, I never create a separate Form Domain object, I like to use just the Domain objects I am using up and down the layers. So I will put Lists of values for combo boxes as separate objects I put into the Model.

Mark



ok so you put your list of value directely in the model.... and in the controller, you have a @ModelAttribute for every list .... before method.get and method.post the list will be feeded....



No, I only need those lists populated in the Get to send back to the form to display to the user in the drop downs.

Then when they post, it is my domain object that gets passed in, the backing bean of the form, I don't need the lists anymore.

Does that make sense?

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic