I'll start by saying that i'm pretty new to servlets.
I just finished my first servlet, using netbeans. But how can i deploy it now? If i right click on the project and press deploy, from what i see it just creates a .war file, but i don't know how to use it. I mean, i don't want to start netbeans in order to use the servlet, i want something like double click and the servlet is online. I use Apache, if it's relevant.
Can you help me, please? Sorry for my beginner question.
Apache is a web server, but what you need is a servlet container - Tomcat is a popular choice.
Joined: Nov 01, 2011
Thank you for your answers, i installed Tomcat 7, i copied the war file to the webapps folder and tomcat extracted the war file. But now i try to access the servlet, it should be on http://localhost:8084/ (that's how it is using Netbeans), but Mozilla says unable to connect (i tried with IE and Opera and it's the same). If i run it inside Netbeans, it works. If i access http://localhost:8080, it finds Tomcat, so Tomcat should be working properly. Am i doing something wrong?
You have to specify your web application name after port number, then slash, then your serlvet name.
Joined: Nov 01, 2011
Again, thanks for the answers.
http://localhost:8080/ServletApp/ The application starts, but when it needs to open another page (it should be called
http://localhost:8080/servlet/TableView it says
HTTP Status 404 - /servlet/TableView
The requested resource (/servlet/TableView) is not available.
I found on the web that it should be because the web.xml is not configured well, but considering it works with netbeans, i'm not sure.
My web.xml looks like this:
My application was called WebApp and initially it didn't start a servlet, it was starting a simple html page, that's why the url looked like that. After some thinking, i realised the problem was with my forms, with the action attribute, it didn't contained the name of the app. Now i modified it, i'm sure it will work but for the moment i have some difficulties with the cache of the browser, i think, because i modified the code, but when i run the app the source looks the same. Anyway, i'm sure i'll be able to solve this on my own.
Thank you again for all your help.