views:

98

answers:

3

I am new in web development world (from microcontrollers to web is a really long path)

Having a Java software (.jar) running, it's just a background process sending/receiving info through sockets, with no interface.


I would like to make a web interface to it, and I need some guidelines, about how to confront these topics


The code:Should I keep it being .jar or it's recomendable to go into .war and deployment? other?

The html/javascript code:Edit the page with an wysiwyg editor? and/or edit the html code within IDE ? / use GWT to develop everything within java? other?

The http server: Use an Apache Server, tomcat? implementing it within java with HttpHandler? other?

The Data: Data is actually in classes, objects and some persistence with writeObject.. should I leave it that way or "web development" is compatible better with mysql or some sql? other?


Just searching for something simple and actual tools, and to avoid reinventing wheels

Experienced web developers, your advices are very welcome!

+1  A: 

I recently learned Spring. It's a very lightweight framework, and very easy to learn and use.

Fernando
I am still researching, what about grails?
Hernán Eche
Grails is a high productivity "convention over configuration" framework like Ruby on Rails. You use Groovy, a dynamic language which runs on the JVM. I've heard great things about it too, and it's powered by Spring. Includes Ajax support, powerful and easy to use view templates using GSP (Groovy Server Pages), compatibility with persistence frameworks, and much more.
Fernando
+2  A: 

I would suggest that you embed Jetty and then add some servlets to connect your existing code.

It really works !

renick
seems good because have both http and servlet
Hernán Eche
I could not believe how simple it was until I tried it. And there is a lot of room for growth later (JSPs etc.)
renick
@renick do you think it's efficient? I mean about performance difference in running a tomcat and a servlet, against embedding jetty, in first case there would be two process, and in the second two threads, perhaps processes could be better managed by SO than threads by JVM?
Hernán Eche
Hi. I used it for an app that accepts about 10-20 client connections depending on shift(time of day). Its working fine for me so far. I dont have any performance numbers comparing it to Tomcat. I assume Tomcat will scale better but it does not embed (or I dont know how to). Jetty was just plain simple to embed. Without embedding considerations Tomcat is the obvious choice.
renick
+2  A: 

If this is an accurate summary

 You have a (presumably) proprietory protocol exposed over a socket interface.

 You desire to access the same function over HTTP, with a Browser based GUI.

Then I would approach it like this:

1). Consider whether to refactor your current code - In concept you have a "core" with a socket interface. What you need is the same "core" with an HTTP interface ... except maybe that doesn't nicely work? HTTP is effectively stateless, with request/response pairs. You might have something much cleverer with your sockets so some redesign might be needed, or maybe it just fits, or even you need to get really clever and use streaming, or Comet or something.

So first decide on an approach. Let's take the optimistic assumption that a standard HTTP model works for you. Then:

2). You may as well use the servlet API, so TomCat or WebSphere Community Edition or any readily acessible servlet engine will do. Just write a few servlets that front your "core".

3). Tools, Eclipse works. Plenty of alternatives, but favour an IDE.

4). Especially when moving to the UI part, editing HTML, or JSPs something WYSWYG is useful. Things get a bit tougher if you want to do a Javascript-based UI - there are products out there but I don't think they're as mature as things such as Eclipse for Java.

djna
@djna the summary closes well, 1) I will keep the core in socket, and it just fit with http interface (but of course avoiding F5 would be great =P), 2) yes Tomcat or the embed Jetty @renick recommended, 3) Eclipse or Netbeans yes..4) I will keep avoiding the UI editor because mixing manual code with automated one is not easy at all (nor good perhaps)
Hernán Eche
Your Javascript and HTML are separate from the rest of the code. Use a specialised editor for these: There is not necesserily any generated code, rather you just see the visual effect of your code
djna