Lunar
Lunar

Reputation: 4711

Converting Java app into a web app, will i benefit from using a framework?

I have created a Java desktop application, and have decided to turn it into a web app. The app carries out basic statistical tests on data and is fairly small around 1000 lines for main functions.

So far i have created the interface using Jquery UI with all requests sent via Ajax. I am now ready to start developing the back end, the plan was to code basic Servlets to link my interface to the core Java classes.

Would this be a ok approach for a small app? or is there a specific framework i should follow?

I have looked over struts but it seems massive and also spring mvc, but again i am not sure if that would work with my one page interface.

(This whole app is for learning purposes, so i am always willing to extend my knowledge, however looking for that doesn't take too long to learn.)

Upvotes: 2

Views: 134

Answers (4)

alf
alf

Reputation: 8513

A framework can get routine off you shoulders. The JAX-RS mentioned above will handle URL-to-service mapping and conversion from JSON to your types and back.

Now, what to choose is entirely up to you. For a small application, the time you spend learning the framework can be so huge that you won't care about the benefits any more. On the other hand, frameworks give you a code which is easier to read and thus easier to maintain.

Upvotes: 2

Jay
Jay

Reputation: 9582

If your program is only 1000 lines, you will probably spend more time learning a framework then the time it will save you. You can make a well designed MVC server without a fancy framework.

There are some APIs that might be useful though, like a logging API or Hibernate if you need a database.

I agree with the other answers that REST is a good idea.

Upvotes: 2

Dan Hardiker
Dan Hardiker

Reputation: 3053

I've started building my webapps as Jersey + Jackson backends, offering up a REST API to a static HTML/JQuery/Angular front end.

It's worked out to be really scalable as you can heavily cache the front end and stick it on Amazon Cloud Front, and the backend can scale horizontally as needed. The need is much lower than traditionally as it's only actual operations that hit the Java server.

Upvotes: 2

Tarlog
Tarlog

Reputation: 10154

I would suggest to expose a RESTful API using some JAX-RS framework (e.g. Jersey) instead of pure servlets.

Also, as a representation I suggest to use JSON, which is very conveniently used in Javascript with/or without JQuery .

Upvotes: 1

Related Questions