Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8112039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:20:16+00:00 2026-06-06T02:20:16+00:00

Learning Spring (3.1.0) and Hibernate (4.1.1). Just wondering what most developers do when handling

  • 0

Learning Spring (3.1.0) and Hibernate (4.1.1). Just wondering what most developers do when handling form data. When writing a JSP that contains a form used to submit data, do you normally write a class specific to the input fields on that form and process that server-side or do you just use your entity classes and bind them to the elemtns on the form?

Say I have an application that has 3 entity classes: Location, StoreType and Store (a Store has a StoreType and a Location). On the form on the /CreateStore JSP page I have a dropdown select box with all Locations, another dropdown select box with all the StoreTypes and other text input fields with store name, store manager etc.

Do you create a CreateStoreForm class with a List locationNames, List storeTypes, String storeName etc. and put this on the model? Or do you just put all the various entity classes on the Model separately? I have been using the latter approach but I am thinking that the former may be better especially for re-populating the screen when a user makes consecutive requests to the same screen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:20:17+00:00Added an answer on June 6, 2026 at 2:20 am

    It’s always good to have a class that maps form, then write a util method which converts from form class to the actual model class which Hibernate would be using to do operations.

    And for the drop-down, you can use @ModelAttribute on a method separately which returns the list and which you will be able to use in form. And you won’t need to add it to your form class or entity class.

    @Controller
    public class MyController {
        @ModelAttribute("productsList")
        public Collection<Product> populateProducts() {
            return this.productsService.getProducts();
        }
        // @RequestMapping etc omitted for brevity
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning spring mvc and hibernate. i have just finished simple site with
Other than learning java, spring, hibernate, servlets, jsp's, how to use eclipse/netbeans, databases like
Learning Spring MVC and Hibernate. import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity
I start learning Spring MVC yesterday, then I figure that in Spring MVC (or
Hey, I'm pretty new in Spring MVC, and I'm learning the JSP tags and
I am just learning Spring3 Validation with Hibernate. I have this class but I
I am just learning Spring3 Validation with Hibernate. I wanted to add Validation so
I have been learning java spring hibernate MVC for 3 months and got pretty
I've been learning how to use the Spring framework for hibernate transaction management, and
I am learning Hibernate and just read the chapter 7.2.3 Adding columns to join

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.