I have installed Tomcat 5.0 in order to execute a web application.
First of all, why are you using the ancient (8 year old) Tomcat 5.0? If you can, rather grab the latest one, Tomcat 6.0.
How can I show my files which are present in Tomcat to the web browser? I tried http://hostname:8080/myfolder/login.html, but I can't see the files.
Is myfolder
the context name or just a folder in your webcontent? If it's a context name, then you need to ensure that it's properly deployed. You can find details in the server logs in the /logs
folder. If it is a folder in your webcontent and the webapplication is thus supposedly to be the "root" application, then you need to ensure that it's deployed as ROOT
.
To learn more about using Tomcat, go through the documentation.
One more thing I know about JDBC and other database connectivity and I have developed a HTML page. How can I let a button in the page execute the code written in a Servlet and perform validations?
To the point, just create a class which extends HttpServlet
, implement the doPost()
method, define the servlet in web.xml
and let the action
attribute of the HTML <form>
element point to an URL which is covered by the url-pattern
of the servlet mapping in the web.xml
.
As the question is pretty broad, I have the impression that you haven't learned in any way how to work with Tomcat and JSP/Servlets. I would strongly recommend to go through those tutorials to familarize yourself with JSP/Servlet on Tomcat and Eclipse (an IDE) first: Beginning and Intermediate-Level Servlet, JSP, and JDBC Tutorials