Question

I want to create a simple server application which runs on the desktop, and when I type my ip and port on the web browser, it connects to the server client which then opens a webpage with appropriate displays coded on the server application.

I read online that I need to use servlet and Apache Tomcat to make a webpage using Java.

I am wondering if there are any easier way to make a simple webpage which can contain buttons without using servlet and Apache Tomcat?

For example, I can use sockets to communicate between server and client applications. Could I change this client into typing the ip address and port on the web browser which will display a webpage created and contained in the server application and remove the need for servlet and tomcat? If so, how do I create a button on the server application so that web browser can see the button when connecting to the server application?

Thank you very much.

Was it helpful?

Solution

If I understand you correctly, you want to have a web page, but you don't want to use Tomcat (or any other servlet engine).

Although it is technically possible to write your own little web server (using server sockets etc), but what you're basically doing then is rewriting Tomcat. Writing a good web server is a daunting job, and should not be taken lightly. I think you are underestimating that. Instead, use what is already there. Tomcat is really quite easy get running.

OTHER TIPS

Creating the server piece could be done with raw sockets, but I would look at at an embedded server like Jetty. I think it will save you a lot of time and headache.

http://docs.codehaus.org/display/JETTY/Embedding+Jetty

You should look into Play Framework. It will be easier then implementing Tomcat or Apache.

Version 1.2.4 is stable and feature-complete for Java, version 2.x is focused on Scala and doesn't have all the features of 1.2.4 yet.

You don't have to create a servlet. But, you need something that can parse a jsp page - it could be tomcat or some other server which has the same capabilities as tomcat. Though I am not sure if I understood your question correctly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top