Reputation: 4286
First, let me apologize, I'm new at web development, so I'm not quite sure how this works, but it's a simple proof of concept, so I don't think it needs to be too advanced.
I have a jar that accesses a server and pulls information that needs to be displayed for the user, I also have a local site that is set up to display this information to the user via html and javascript (but obviously doesn't connect to the server or that jar). I plan on using tomcat to act as a middleware server that will display the web page and handle the code that accesses the server.
I've seen it done before, but I'm not quite sure how to set it up. Can somebody just give me the basics on where things need to go to make this work? I think I'd be ok after that.
My Google-Fu has failed me in finding this, so really any help is appreciated.
Thanks!
Upvotes: 1
Views: 525
Reputation: 46720
If you use Netbeans, you start by creating a Web Application Project (see tutorial here).
The project binds the JSP pages (the HTML) with a servlet. Inside the servlet, you access the server functions (inside the jar) and send the information back to the jsp file to display.
Netbeans will deploy the project to Tomcat for you if you select Tomcat as the default server in the Properties / Run dialog for that project.
Or you can copy the war file into the $TOMCAT_HOME/webapps/ directory. Tomcat will deploy the war file by automatically exploding it.
Upvotes: 0
Reputation: 8969
Here are a few things you need to learn :
Your Java web application project must have folder structure of a webapp project. This is normally automatically created by your IDE when you choose to create a webapp project. For me, I am using maven to organise my webapp project so it slightly different from ant project.
You will need to learn where to put you Java classes, JSP pages, resources in your webapp project folders.
Try creating a HelloWorld page in your webapp, then learn how to config your web.xml
Most IDEs can create war file for you. One war file is created you will have to deploy it in tomcat webapp folder. I don't think many people packing war file manually.
Let me know if you want me to explain it in more detail.
Upvotes: 0
Reputation: 10493
I would probably start by download an edition of Eclipse that is aimed at Web Development and creating a new web project directly in there.
This is the Eclipse you want:
http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/heliossr1
This article could be outdated, but the general idea and the general workflow is still valid:
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
Basically, you have to download Eclipse and Tomcat, and create a new web application in Eclipse that uses Tomcat for debugging, and then from Eclipse itself you can generate the WAR file with everything on the right place - this is the file that you will need when deploying the application in your production environment. To do that, you simply copy the file to the ./webapps folder that is sitting in the folder where Tomcat is installed.
PS: I don't know what the state of things is, I personally like using Tomcat 5.5, but I am pretty sure Tomcat 6 will work just fine for what you need.
Upvotes: 1