Reputation: 852
I'm currently working on building a java web app. I've been looking to use Spring and Hibernate so I get some proper exposure to them, but I'm just getting burned out reading and learning about them. If I go ahead and build it with JSP and Servlets on a MySQL back end, what kind of levels of code reuse would I be looking at? I imagine the JSP's and POJO's would be more or less identical, but what about the rest of the code?
Thanks!
Upvotes: 1
Views: 2262
Reputation: 403481
If you build using servlets, JDBC DAOs and JSPs, then it would be fairly straightforward to introduce Spring to the application at a later date:
You can do any of these steps in any order, one step at a time. Spring is pretty good at being useful for as much as you want it to be, and then getting out of the way.
Hibernate's a different kettle of fish. It's big and complex, and a bit scary to begin with. I suggest getting settled in with Spring first, since Spring makes Hibernate a bit easier to handle.
Upvotes: 4
Reputation: 308763
It's likely that you can reuse the JSPs, assuming that you use JSTL and not scriplet code. You'll add Spring tags.
Hibernate isn't 100% necessary. You can start with Spring JDBC and migrate to Hibernate only if you think it can help you. I'd call that a second step to take after you have the functionality working under Spring.
Spring's pretty good for working alongside other code. It need not be an all or none proposition.
Spring will have you create a service interface. You'll have a persistence layer. The web MVC will isolate all the view concerns. You'll use Spring's front controller servlet to route requests to controllers. The controllers will worry about validation and binding HTTP parameters to objects and passing them to the services to fulfill the request.
You don't talk about security. Spring security will be a bonus.
Upvotes: 1
Reputation: 4703
Refactoring is always a hard job.... You should consider iterative section refactoring (modules/logical units).
Spring isn't invasive. So its use should be easy. Have a look at "don't repeat the dao" from IBM. They have best practices which help you with a clean implementation.
If you use spring, you should have a look at spring webmvc!
Upvotes: 0
Reputation: 4678
It depends on
If you have biz logic separated, and use mostly pojo's, then it's easier.
Then it depends on how much spring and hibernate you want to use.
For a generig aproach, you will want to reorganize your app in a layer oriented way:
Upvotes: 0