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.
This is Ramesh. I am implementing spring and hibernate in my application. I have to get values from single form like registration form and store these values into two tables like user table and person table.
using hibernate these two tables need two bean classes, I have implemented these beans with names login.java and person.java.
for getting form details we have to register command class in form controller, I know for single table.
can any one please give me suggestion how do i get form details with spring bind for storing form values into multiple tables.
Well I recommend using Spring MVC, create an @Controller class with two methods one to setup the form and one to handle the submit, for the setup method annotate it with @RequestMapping(HttpRequest.GET) for the submit annotate it with @RequestMapping(HttpRequest.POST) (something like that, you will need to consult the documentation for the correct class and Constant). You will also need the documentation for loading up the ApplicationContext into the web environment and also deploying the DispatcherServlet, but that is all in the docs.