Servlet Context parameters are application wide parameter (such as global variables) accessible through out web application, any servlet or Jsp page can access these parameters, and there is only one copy of such parameters per web app.
These parameters are to be configured in web.xml file in java web application.
Servlet config parameters are specific to the servlet for which is declared, it is local for that servlet. These parameters are private to each servlet. These parameters are also configured in web.xml (inside servlet tag).
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Server : Apache Tomcat 7
Deployment descriptor file which is also known as web.xml file, is used to configure the web app as well as servlet.
It is most important while the web app is to be deployed on the server, for example the database connection is going to differ while you deploy the app on server, so its preferable to define such settings in web.xml file because its a tag file which can be easily editable in any editor.
If we define the such settings in java file they need to be edited and re-compile on server, which is not feasible.
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Server : Apache Tomcat 7
Servlet Interface provides general activities for servlet.
It resides in javax.servlet.Servlet, when implementing Servlet following five method must be implemented (init, service, destroy, getServletConfig & getServletInfo).
OS : Windows 10 Jdk : Version 8 IDE : Eclipse Mars Server : Apache Tomcat 7
Menu Driven application in Java to use various JDBC operation. In this example DB operation is managed by a class called “clsDB.java”, the Student data is managed by a class called “Student.java”. The “Main.java” file consist of Main function as well as menu to perform various operation related to student.
To connect with MySQL database, one need the valid driver and URL string. Below is the user defined class that connect with the MySQL database and also manages the other operation such as related to it.
Below is the list of methods that handles various database operation.
Execute SQL
Defines and returns the Result set related to a query
Add, Update, Delete and Display the “Student” class details