views:

112

answers:

2

I have a rather large (80k loc) java desktop app that talks to a database. We're now looking at exposing some parts of the database via a web application, using the existing codebase and preferably not having to modify it.

I have good separation between the data access, business logic and presentation layers, but we haven't used enterprise java beans or anything like that (if that's important).

What's the best way forward? Which of the java web frameworks will be best suited to the problem? Learning curve isn't terribly important, since I haven't done any java development on the web...

+1  A: 

To be true, it depends what you already have, and how well is the design of your current desktop application. You might not be able to use any or may be minimal of your existing code without modifying it, if its designed badly, and everything is tightly coupled.

Assuming that you are having a system with a good design, everything is de-coupled well enough. You can look into Stripes to make your presentation for the web, and use your existing data access and business code. I wish you all the luck.

Few other goodies to look into are, Groovy on Grail, Wicket.

I don't recommend anything like Seam and Spring they are more of a container and sophisticated large frameworks, which give you almost everything, solution for almost all of your problems. As you mentioned that you already have a complete system, and you just need to make a web interface to publish it for the web, these are not recommended, IMO.

JSF, is a good framework, but it might drive you nuts and has a big learning curve, according to few folks.

Adeel Ansari
"I don't recommend anything like Seam and Spring they are more of a container and sophisticated large frameworks" JSF is in that boat as well imo
SCdF
Hmm... may be. But IMO, JSF doesn't try to answer all your questions, and rather stick to the presentation layer. Moreover, it doesn't really work like a container, like Seam and Spring IoC. As far as, the term sophisticated goes, I tend to agree.
Adeel Ansari
Thanks for the pointer to Stripes - looks like the most straight-forward option at the moment. As I said, the code is very well separated, I expect to be able to reuse all of the access code, and the majority of the logic code (all of it with a little refactoring)...
rjohnston
A: 

The two frameworks I would recommend would be Grails and Struts 2.

Grails comes with a whole bunch of stuff that it configures under the covers including Hibernate and Spring. It makes generating dynamic pages to send to the browser ridiculously easy. What you are probably going to need to do is set up controllers that call Grails services which reference your existing code as you probably don't want Grails managing your database interactions. The disadvantage with Grails is not so much that it is written in Groovy, which is easy to learn for Java programmers, but that the IDE support for Groovy is still maturing. Still if you want quick productivity this is the route to go down.

Struts 2 offers a clean command pattern framework implementation that talks to JSPs (or velocity or FreeMarker templates) on the front end. To use this you would configure actions to call your existing code. You may want to investigate adding Spring to the mix depending on what you need to do.

There are other choices but these are two that I have had some success with.

Peter Kelley