views:

96

answers:

4

Possible Duplicate:
Java: How to invoke code running on a server from a browser?

I just asked: Java: How to invoke code running on a server from a browser?

I got back numerous suggestions. Here is a short summary:

  • Java Servlets
  • Java Server Pages
  • Java EE
  • Tomcat
  • Axis
  • Glassfish

I am not sure what I should prioritize. I have a small class project that I need to execute some code on a server. I basically need to:

  1. Get some info from user via browser
  2. Pass info to Java code running on the server
  3. Display results to user

I have an Apache server that I just setup (I have put an index.html there but that is it). I am not sure how to proceed. Could someone point me to a tutorial? I have tried doing some Googling but I am not entirely sure what I should be searching for.

Edit: I am using Eclipse right now, and I just noticed that under new it has a Java EE option. I am exploring that.

A: 

You need the following:

  1. Tomcat or Jetty
  2. JSP

Tomcat (or Jetty) are the server platforms that host your code. JSP is the programming language that you'll write your code in.

If you know some programming basics, you'll find JSP easy to learn. Here's an easy tutorial, and here's another one, and a third cool one. You'll also need to know some very basic html.

I hope that this help. If you need anything more, just ask.

Mustafa
jsp is not a language
hvgotcodes
Glassfish is another servlet container. It might make sense for the OP to attempt to categorize the suggestions he's received so far - his list of names all revolve around using servlets in a servlet container
matt b
A: 

This is a tutorial on how to create a servlet with Eclipse's wizard for doing so.

matt b
+3  A: 

There are two aspects to a Java Web Application. First is developing the Java Web application and the other is actually running a web application.

The simplest things to get started with developing a Java webapp, is to understand and use 1. Java Servlets 2. Java Server Pages (JSP) 3. JavaEE jdk

To actually have the web application run, you have to host it inside a Java Servlet Container (A web server). From the list that you have mentioned, Tomcat and Jetty are both Servlet containers, you can choose either one.

Once you have understood the basics, you can then move forward to things like JavaEE and the various other frameworks and start looking into what Actual Java Application servers like Glassfish, JBoss etc.

You do not need the Apache httpd server. This is not directly useful for serving a java web application (although it has indirect uses, which you would probably understand once you have covered your basics).

As you mentioned, you are using eclipse. I would suggest you start with the 'Dynamic Web Application' project rather then a JavaEE project. This will set up a basic Java servlets based project for you to get started on. Also the tutorial provided by matt b is an excellent resource on how to develop a simple servlets based java web application using eclipse and run it on tomcat.

Pratik Bhatt
A: 

I would suggest you install Tomcat.

Run the examples that are available out of the box at http://localhost:8080/examples

click on the JSP examples in the browser, and click on Execute for any one of those which show Form elements like textbox, checkbox.

Then navigate to the examples directory on the file system under /webapps/examples/jsp

The simple thing is to try changing the JSP code there, and start modifying the code in there to capture what you want and follow it down the trail.

JoseK