Finishing the Project: Java Web Development in Eclipse and Tomcat
Last week, I introduced you to some of the fundamental concepts you need for working with Java web components. For this project we'll be working with JSP and servlets. I walked you through getting the appropriate downloads installed and setting up your work space. We stopped after just creating the web project. In this part, we will add our content, including HTML, JSP, and servlets.
Finishing the Project: Java Web Development in Eclipse and Tomcat - Run the web application in the Eclipse environment (Page 3 of 4 )
Now we have the simplest web application consisting of a static HTML page and a JSP of mixed Java code and static HTML content. Now we can test out the new dynamic Web project from Eclipse within its integrated Tomcat server environments.
Highlight login.html, then from the context menu, select Run As -> Run on Server
The previously defined Tomcat 5.0 server environment is displayed. Click finish
Now the web component is running under the Tomcat environment and the login.htm screen page is displayed in Eclipse's built-in browser.
Enter "user" as User name and "pass" as Password then click the login button. You'll see the following content:
Welcome aboard user!
Click login button
As we explained before in login.html's code:
<form action="welcome.jsp" method="post">
It takes you to the welcome.jsp page and the message is displayed.
Press the browser's back arrow, Clear the User name and Password fields then click the login button, and you'll see
Wrong username / password
This message results from the following code from welcome.jsp: