servlet doGet /doPost

there is a method to get the launch the doGet method servlet when we start the server on eclipse or when we access the server.
there is a JSP page which is in charge to display all the details given by a database.
we must load the database before launching the JSP and displaying the date.

all the magic happen in the web.xml configuration file :

================================================================================================================================================================

 

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://java.sun.com/xml/ns/javaee” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” version=”3.0″>
<display-name>Lab03_Project</display-name>

<context-param>
<param-name>instruction</param-name>
<param-value>
Please enter a temperature to convert.
</param-value>
</context-param>

<servlet>
<servlet-name>Driver</servlet-name>
<servlet-class>a00805231.assignment1.Driver</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Driver</servlet-name>
<url-pattern>/assignment1</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>assignment1</welcome-file>
</welcome-file-list>
</web-app>

we have to get the serlvet name Driver and the access to the Main class called Driver as well.
there is a server mapping which is going to map the url assignment1 to the servlet name.

then there is the welcome file before it was my main JSP page called index.jsp so the server were launching this page by default then skipping the doGet method which load the DB(this need to be fixed later to implement this inside the init method of the servlet.
here we choose to provide the url-pattern called assignment1 which is going to launch the servelet main class and the doGet by default.

This is a remionder for me in case i need this later.