问题
I am modifying existing java web application that was written long time ago, and it is written in the wrost possible way. It has business logic and sql statemens in JSP files.
Because of the certain constraint, I can not re-design the entire application. but I can implement better design in any new feature that I add.
can anybody suggest me any MVC framework that I could easily integrate in existing app. I need to have framework that is not depended on many external jar files and it does not cause any issues with existing application.
回答1:
I am modifying existing java web application that was written long time ago, and it is written in the wrost possible way. It has business logic and sql statemens in JSP files.
Sounds like a good candidate for being thrown away to me.
Because of the certain constraint, I can not re-design the entire application. but I can implement better design in any new feature that I add.
The entire app needs to be re-designed, but you can't redesign the entire app. It's contradictory.
can anybody suggest me any MVC framework that I could easily integrate in existing app. I need to have framework that is not depended on many external jar files and it does not cause any issues with existing application.
You can't help but cause issues with the existing application, and there will be external JAR dependencies if you use a framework. I'd still recommend it, because a framework will give you a lift that will be worth the extra JARs. Your WAR file will be bigger - so what? Disk space is cheap.
Sounds to me like MVC is the least of your problems. You should be concentrating on the idea of a properly layered application first. If you had well-defined persistence and service tiers you might have a chance.
Think about the problem without worrying about the UI for now. Start with the persistence tier. Get a DAO and model objects going. Then move onto the service tier: transactions, units of work, and use cases implemented using the DAO and model objects. Unit test both layers thoroughly.
Once you have those you're free to concentrate on making the view tier work properly. It'll be easier letting the controllers interact with services. Your UI can be HTML, CSS and JavaScript or Flex. All the logic will be out of the view and into the back end where it belongs.
Don't be afraid of JAR dependencies. It could steer you away from something that will help you. I'd recommend Spring first and foremost. It'll help with all your layering issues. Its web MVC is as good as there is, too.
回答2:
If you can't re-design the whole application and are concerned about the weight of the framework, then I suggest not adding a framework. You'll end up with a Frankenstein build where the application is inconsistent, and not a lot of benefit.
Instead, why not roll your own? When you add new features (or revise existing ones), you don't have to cram everything into a jsp. Create your own data access layer, and your own business object, and link those to each other and to the UI in your jsps appropriately.
来源:https://stackoverflow.com/questions/3001777/mvc-framework-for-existing-application