I'm a Java programmer who is trying to make it on his own in the real world. I'm the only programmer at my company so I am pretty much learning as I go using the web and books and lots of trial and error.
Anyways, I am pretty good at J2SE, and up until now that was all I needed. Now I need to make a web-browser based application.
My main problem is I don't even know where to begin!
Here is what I need to do:
Host some sort of web application on a weak system. Ex: 500mhz processor and 256mb of ram. It needs to dynamically update every 10 seconds or so and also contain real time charts that update with no refresh needed.
What technologies should I be looking at to do this kind of thing. I know Java SE, python and PHP. I don't know very much about dynamic web programs.
I was thinking about using an applet, but they seem to be very outdated. What's the modern day Java alternative?
Since you said you didn't know where to begin I'll just start throwing around a few things to get you thinking. Hopefully they make sense; if not -> that's why we have these forums.
Web applications in Java use the Servlet and JSP APIs. Servlets are for writing server-side code that reacts to HTTP requests, and JSPs are a templating technology somewhat akin to PHP. They're generally used together: servlets accept the requests, parse the parameters, and execute the logic, while JSPs then generate the HTML output.
You'd need a server that can handle Servlets/JSP, a so-called servlet container. A very capable one is Tomcat by the good folks at Apache. It also doubles as a regular web server, so you don't need to set up an additional Apache httpd to go with it (like you'd need for PHP).
As for charts that change over time and can refresh themselves, there's a very capable library called JFreeChart that creates images out of data. It integrates nicely with JSP pages via the cewolf library. You can find links to both -plus introductory material- in the OtherOpenSourceProjectsFaq. If you embed such a chart in a web page that refreshes itself automatically every N seconds you would have what you're asking (I'm assuming that the page refresh isn't itself the problem, but rather the manually required invocation of same). But you probably need to become proficient at servlets/JSP before tackling the charts.
Lots of information to ponder and be confused about. But not to despair - we have forums for all these topics right here at JavaRanch, so don't hesitate to ask. [ February 04, 2008: Message edited by: Ulf Dittmer ]
posted 11 years ago
Thanks for the information!
I forgot to mention I have used JSP before. I briefly used them for one of my courses for about 2 months. I also used Tomcat, so I am familiar with Tomcat.
For my other projects at work I use the Apache HTTP server extensively.
I had never heard of Servlets. My main issue was just knowing what the technology I was looking for is called. Everything kept pointing me toward AJAX, but I would rather use something more similar to Java SE.
My next question is can I reuse some of my J2SE code in my servlets. I have a bunch of libraries I wrote for this project that I am hoping to reuse. They are written pretty generically to make reuse on future projects easier.
Originally posted by Jon Parise: Everything kept pointing me toward AJAX, but I would rather use something more similar to Java SE.
Bear in mind that Ajax is just the client-side means to make requests back to the server without requiring a full-page refresh. Nothing in Ajax precludes the use of Java technologies on the server. In fact, Ajax and JSP are a match made in heaven.
Thanks for all the help thus far, I truly do appreciate it.
I read through a good bit of the Servlet cattle drive. I got some Servlets working with Tomcat but I still have a few big picture questions.
From what you have all said, Servlets are client side which means they can do AJAXesque updating without refresh correct?
Also, do Servlets have any kind of graphics library? I can create graphs pretty well in J2SE just using the standard graphics classes and was wondering if I could pull off something similar with servlets.
My final question is how light weight is Tomcat? Is there something that ca handle JSP and Servlets that is lighter weight? I will only have a few connections and I am putting the server on a Linux embedded device. Naturally, I need a server with a small foot print. This is why I chose Derby for my database.
permaculture is giving a gift to your future self. After reading this tiny ad: