• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Java » Servlet

MySql SUBTIME Function in Java Servlet

By Dinesh Thakur

This Function will Subtracts time.

First i make a table in database named ‘dbase’ with required fields and values which is under the reference of mySql(php myAdmin). Here i import all mandatory java packages from the java library as program needs. Then after, i make a class named ‘MySqlSubTimeFunc’ extends ‘HttpServlet’. And here i use serviceMethod() which will get request from the doGet()Method for getting output on the web browser. After, i load all the required drivers for accessing database. After, then i declare mandatory variables as i declare ‘Connection’ this variable does the job to create a link between database and the actual code. The other one i declare is ‘resultSet’ that will fetch the value from selected column and rows. Now here i declare the ‘preparedStatement’ that will use to execute the selected query like executeQuery() as (SELECT SUBTIME(‘2:00:00.0’) AS hrago).Here i use the doGet()Method for output on a web browser.

I use ‘HTML’ code and some of its tags that will provide the output on the web browser in tabular form.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSubTimeFunc extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                   Class.forName(driver);
                   con = DriverManager.getConnection(url,uid,psw);
                   ps=con.prepareStatement("SELECT SUBTIME('2:00:00.0') AS hrago");
                   rs = ps.executeQuery();
               String title = "Using Sub Time Function";
                   String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
               disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                   "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
               "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Result</th>\n"+ "</body> </html>");
                   while(rs.next())
                     {
                          String curr = rs.getString(1);
                      disp.println("<tr><td align=\"center\">" + curr +"</td></tr>" );  
                     }     
               }      
                     catch(Exception e) 
                        {
                         e.printStackTrace();
                        }
                         disp.close();
       }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSubTimeFunc</servlet-name>
   <servlet-class>MySqlSubTimeFunc</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSubTimeFunc</servlet-name>
   <url-pattern>/MySqlSubTimeFunc</url-pattern>
</servlet-mapping>

MySql SUBSTRING_INDEX Function in Java Servlet

By Dinesh Thakur

This Function will return a substring from a string before the specified number of occurrences of the delimiter.

First i made a database named ‘dbase’ within the reference of mySql(php myAdmin).Then i import all the required java package from java library according to  need of program. Then i made a class named ‘MySqlSUBSTRINGINDEXFunction’, which extends ‘HTTPSERVLET’ completely. Then after i use service()Method that will bring the request from doGet()Method for output on the web browser. Then after, i loaded al the required drivers for database accessing. Here i declare variables for next use of program i declare ‘connection’ that will use to create a link between the database and the java code. Here i use ‘resultSet’ that will use to get the value from the selected columns and the rows. At the last instance of declaring variable i use ‘preparedStatement’ that will use to executing the selected Query like executeQuery as (Select SUBSTRING_INDEX(‘servlet.mysql.org’,’.’,2)). I use doGet()Method for output on web browser.

I use ‘HTML’ code and tags to show output in tabular form on the web browser that will make output in manner Form.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSUBSTRINGINDEXFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
        {
            rp.setContentType("text/html");
            PrintWriter disp = rp.getWriter();
            String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://localhost/dbase";
            String uid = "root";
            String psw = "root";
            Connection con=null;
            PreparedStatement ps = null;
            ResultSet rs;
            try
             {
                 Class.forName(driver);
                 con = DriverManager.getConnection(url,uid,psw);
                 ps=con.prepareStatement("Select SUBSTRING_INDEX('servlet.mysql.org','.',2)");
                 rs = ps.executeQuery();
             String title = "Using SUBSTRING_INDEX Function";
                 String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                 "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
             "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                 while(rs.next())
                    {
                         String val = rs.getString(1);
                     disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                    }     
              }       
                     catch(Exception e) 
                         {
                         e.printStackTrace();
                         }
                         disp.close();
         }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSUBSTRINGINDEXFunction</servlet-name>
   <servlet-class>MySqlSUBSTRINGINDEXFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSUBSTRINGINDEXFunction</servlet-name>
   <url-pattern>/MySqlSUBSTRINGINDEXFunction</url-pattern>
</servlet-mapping>

MySql SUBSTRING Function in Java Servlet

By Dinesh Thakur

This Function Will Return the substring as specified. [Read more…] about MySql SUBSTRING Function in Java Servlet

MySql SUBSTR Function in Java Servlet

By Dinesh Thakur

This Function Will Return the substring as specified.

First, i use to make a database named ‘dbase’ within the reference of mySql(php myAdmin). Then i use to import all required java package from java library. Then after calling all the packages, i made a class named ‘MySqlSUBSTRFunction’, which extends ‘HttpServlet’. I use service()Method which will use to getting the request from doGet()Method for output. Then i loaded all the required drivers for database accessing. After loading driver, I declare the variables like i use ‘connection’ variable that will use to create a link between the database and the java code. Then after, i use ‘resultSet’ that will act as to fetching value from the selected column and rows. I use ‘preparedStatement’ that will use to executing the selected query like executeQuery as (Select SUBSTR(‘servletmysql’,5,4)). I use doGet()Method in last interface which will use to get output on the web browser.

I use here some tags of ‘HTML’ that will bring output in a tabular form as required.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSUBSTRFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
              rp.setContentType("text/html");
              PrintWriter disp = rp.getWriter();
              String driver = "com.mysql.jdbc.Driver";
              String url = "jdbc:mysql://localhost/dbase";
              String uid = "root";
              String psw = "root";
              Connection con=null;
              PreparedStatement ps = null;
              ResultSet rs;
              try
               {
                   Class.forName(driver);
                   con = DriverManager.getConnection(url,uid,psw);
                   ps=con.prepareStatement("Select SUBSTR('servletmysql',5,4)");
                   rs = ps.executeQuery();
               String title = "Using SUBSTR Function";
                   String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
               disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                   "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
               "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                  while(rs.next())
                      {
                          String val = rs.getString(1);
                      disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                      }     
            }         
                      catch(Exception e) 
                          {
                           e.printStackTrace();
                          }
                           disp.close();
          }
                           public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                {
                                     doGet(rq,rp);
                                }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSUBSTRFunction</servlet-name>
   <servlet-class>MySqlSUBSTRFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSUBSTRFunction</servlet-name>
   <url-pattern>/MySqlSUBSTRFunction</url-pattern>
</servlet-mapping>

MySql STR_TO_DATE Function in Java Servlet

By Dinesh Thakur

This Function will Converts a string to a date.

First, I make a table in database named ‘dbase’ with required fields and values in it and within the reference of mySql(Php Admin).Then i import all the required java package from java library. I made a class named ‘MySqlStringToDateFunc’ extends the ‘HttpServlet’. Then i use serviceMethod() which will bring the request from doGet()Method for Output. Then i load all the drivers for database accessing. After then, i declare variables which are necessary for database conditions like i declare connection(this variable will use to make a link between database and java code or actual code).after then i declare resultset (this variable will use to get the values from desired columns and rows as required from query). The next one will be the preparedStatement (this variable will responsible for the executing query like executeQuery() as (SELECT STR_TO_DATE(‘21,05,2014′,’%y,%m,%d’) AS str). In the last i used the doGet()Method which will bring the output on the web Browser.

I use here ‘Html’ code and tags that will present the output in tabular form on the web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlStringToDateFunc extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
        {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                  Class.forName(driver);
                  con = DriverManager.getConnection(url,uid,psw);
                  ps=con.prepareStatement("SELECT STR_TO_DATE('21,05,2014','%y,%m,%d') AS str");
                  rs = ps.executeQuery();
              String title = "Using String To Date Function";
                  String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
              disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                  "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
              "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Result</th>\n"+ "</body> </html>");
                  while(rs.next())
                      {
                           String curr = rs.getString(1);
                       disp.println("<tr><td align=\"center\">" + curr +"</td></tr>" );  
                      }      
             }        
                       catch(Exception e) 
                        {
                            e.printStackTrace();
                        }
                            disp.close();
         }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlStringToDateFunc</servlet-name>
   <servlet-class>MySqlStringToDateFunc</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlStringToDateFunc</servlet-name>
   <url-pattern>/MySqlStringToDateFunc</url-pattern>
</servlet-mapping>

MySql STRING COMPARE Function in Java Servlet

By Dinesh Thakur

This Function Will Compare two strings.

First i make a table in database named ‘dbase’ within the reference of mySql(php myAdmin). Then i import all the mandatory java packages from the java library as required for program. I made a class named ‘MySqlSTRINGCOMPAREFunction’, which extends ‘HttpServlet’. I use serviceMethod() which is been carry the request from doGet()Method for Output. Then after, to declare the variable i loaded all the required drivers before for database accessing. Here i declare the variables like ‘connection’ this variable will create a link between database and java code. Then i call ‘resultSet’ this will be responsible for Getting value from the selected columns and the rows. Then i declare ‘preparedStatement’ which will get to execute the selected query like executeQuery() as (Select STRCMP(‘MySql’,’MYSQL’) AS strcmp).Here i use doGet()Method which will use to get output on the web browser.

While the programming i use ‘HTML’ code or tags to bring output in tabular form on the web Browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSTRINGCOMPAREFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                  Class.forName(driver);
                  con = DriverManager.getConnection(url,uid,psw);
                  ps=con.prepareStatement("Select STRCMP('MySql','MYSQL') AS strcmp");
                  rs = ps.executeQuery();
              String title = "Using String Compare Function";
                  String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                 "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
             "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Result Is </th>\n"+ "</body> </html>");
                 while(rs.next())
                     {
                          String val = rs.getString(1);
                      disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                     }     
              }       
                      catch(Exception e) 
                         {
                           e.printStackTrace();
                         }
                           disp.close();
         }
                         public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSTRINGCOMPAREFunction</servlet-name>
   <servlet-class>MySqlSTRINGCOMPAREFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSTRINGCOMPAREFunction</servlet-name>
   <url-pattern>/MySqlSTRINGCOMPAREFunction</url-pattern>
</servlet-mapping>

MySql SQRT Function in Java Servlet

By Dinesh Thakur

This will Returns the non-negative square root of numeric expression.

First i made a database named ‘dbase’ within the reference of mySql(php myAdmin).Then after, I import all java packages from java library as program need. Here i made a class named ‘MySqlSQRTFunction’, which extends ‘HttpServlet’. I use service()Method that will help to getting the request from doGet()Method for output on web browser. Then I loaded all the required Drivers that will help to accessing Database. After then i declare variable first i use ‘connection’ variable that will create a link between database and the actual code(frontend and the backend).Other variable is ‘ResultSet’ that will help to fetch value from the columns and rows as required query. The next variable is ‘preparedStatement’ that will use to executing the selected Query like executeQuery as (Select SQRT(7)).I use doGet()Method in last instance that will bring the output on web browser.

I Use ‘HTML’ code and some tags, which will show the output in tabular form on the web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSQRTFunction extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
        {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                   Class.forName(driver);
                   con = DriverManager.getConnection(url,uid,psw);
                   ps=con.prepareStatement("Select SQRT(7)");
                   rs = ps.executeQuery();
               String title = "Using SQRT Function";
                   String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
               disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                   "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
               "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                   while(rs.next())
                       {
                            String val = rs.getString(1);
                        disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                       }     
              }       
                        catch(Exception e) 
                         {
                              e.printStackTrace();
                         }
                              disp.close();
          }
                            public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                {
                                 doGet(rq,rp);
                                }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSQRTFunction</servlet-name>
   <servlet-class>MySqlSQRTFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSQRTFunction</servlet-name>
   <url-pattern>/MySqlSQRTFunction</url-pattern>
</servlet-mapping>

MySql SPACE Function in Java Servlet

By Dinesh Thakur

This function will return a string of the specified number of spaces.

First i make a table in database named ‘dbase’ with required fields and values in it and within the reference of mySql(Php Admin). Then i import  all the required java package from java library. I made a class named ‘MySqlSPACEFunction’ extends the ‘HttpServlet’. Then i use serviceMethod() which will bring the request from doGet()Method for Output. Then i load all the drivers for database accessing. After then i declare variables, which are necessary for database conditions as i declare connection (this variable will use to make a link between database and java code or actual code). After then i declare resultset (this variable will use to get the values from desired columns and rows as required from query).the next one will be the preparedStatement (this variable will responsible for the executing query like executeQuery() as (Select ‘My’,SPACE(1),’SQL’ AS spc). In the last i used the doGet()Method which will bring the output on the web Browser.

I use here some tags of ‘HTML’ that will bring output in a tabular form as required. 

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSPACEFunction extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
       {
           rp.setContentType("text/html");
           PrintWriter disp = rp.getWriter();
           String driver = "com.mysql.jdbc.Driver";
           String url = "jdbc:mysql://localhost/dbase";
           String uid = "root";
           String psw = "root";
           Connection con=null;
           PreparedStatement ps = null;
           ResultSet rs;
           try
            {
                Class.forName(driver);
                con = DriverManager.getConnection(url,uid,psw);
                ps=con.prepareStatement("Select 'My',SPACE(1),'SQL' AS spc");
                rs = ps.executeQuery();
            String title = "Using Space Function";
                String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
            disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                 "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
             "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Result Is </th>\n"+ "</body> </html>");
                 while(rs.next())
                    {
                         String val = rs.getString(1);
                     disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                    }     
              }       
                     catch(Exception e) 
                        {
                         e.printStackTrace();
                        }
                         disp.close();
        }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSPACEFunction</servlet-name>
   <servlet-class>MySqlSPACEFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSPACEFunction</servlet-name>
   <url-pattern>/MySqlSPACEFunction</url-pattern>
</servlet-mapping>

MySql SOUNDS LIKE Function in Java Servlet

By Dinesh Thakur

This Function will compare sounds.

Firstly, i made a table in database named ‘dbase’ with required fields and values in it. I import all the required java packages from the java library. I made a class named ‘MySqlSOUNDSLIKEFunction’, which extends the ‘HttpServlet’. After then i use serviceMethod() which will bring the request from doGet()method for output. Then after, i loaded all required drivers for the database accessing declare some mandatory variable for database connecting like i declare ‘Connection’ (this variable will use to create a link between database and the java code or actual code). The next will be ‘resultSet’ the variable will be responsible for the getting values from required columns and rows. The other one variable will be ‘preparedStatement’ this variable will use to execute the Selected Query like executeQuery() as (SELECT ‘MySql’ SOUNDS LIKE ‘MySql’ AS slike). I use doGet()Method which will bring the output on web browser.

While on the web browser to get output in tabular form i use ‘HTML’ code and tags.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSOUNDSLIKEFunction extends HttpServlet
    {
        public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
          {
               rp.setContentType("text/html");
               PrintWriter disp = rp.getWriter();
               String driver = "com.mysql.jdbc.Driver";
               String url = "jdbc:mysql://localhost/dbase";
               String uid = "root";
               String psw = "root";
               Connection con=null;
               PreparedStatement ps = null;
               ResultSet rs;
               try
                {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("SELECT 'MySql' SOUNDS LIKE 'MySql' AS slike");
                    rs = ps.executeQuery();
                String title = "Using SOUNDSLIKE Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                     "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                    while(rs.next())
                       {
                             String val = rs.getString(1);
                         disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                       }     
            }         
                         catch(Exception e) 
                           {
                                e.printStackTrace();
                           }
                                disp.close();
           }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                {
                                     doGet(rq,rp);
                                }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSOUNDSLIKEFunction</servlet-name>
   <servlet-class>MySqlSOUNDSLIKEFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSOUNDSLIKEFunction</servlet-name>
   <url-pattern>/MySqlSOUNDSLIKEFunction</url-pattern>
</servlet-mapping>

MySql SOUNDEX Function in Java Servlet

By Dinesh Thakur

This Function will return a soundex string.

First i made a database named ‘dbase’ within the reference of mySql(php myAdmin). Then i import all the required java packages from java library as program essentials. I made a class named ‘MySqlSOUNDEXFunction’, which extends ‘HttpServlet’. Then i use service()Method which will use to get the request from the doGet()Method for output on the browser. I loaded all the required drivers for accessing database as required. Then i use to declare the variable as i use ‘connection’ this will use to create a link between the database and the java code. Then i declare ‘resultSet’ this will responsible for get the value from selected columns and the rows. I use here now ‘preparedStatement’ this will execute the selected Query like executeQuery as (Select SOUNDEX(‘JavaMySql’) as sndex). Then i use doGet()Method that will bring the output on the web browser.

For getting the output in the tabular form, I use ‘HTML’ code and tags that will show output in a manner way on web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSOUNDEXFunction extends HttpServlet
   {
        public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
           {
               rp.setContentType("text/html");
               PrintWriter disp = rp.getWriter();
               String driver = "com.mysql.jdbc.Driver";
               String url = "jdbc:mysql://localhost/dbase";
               String uid = "root";
               String psw = "root";
               Connection con=null;
               PreparedStatement ps = null;
               ResultSet rs;
               try
                {
                     Class.forName(driver);
                     con = DriverManager.getConnection(url,uid,psw);
                     ps=con.prepareStatement("Select SOUNDEX('JavaMySql') as sndex");
                     rs = ps.executeQuery();
                 String title = "Using SOUNDEX Function";
                     String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                 disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                     "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                 "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                     while(rs.next())
                        {
                            String val = rs.getString(1);
                       disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                        }     
            }         
                       catch(Exception e) 
                          {
                          e.printStackTrace();
                          }
                          disp.close();
          }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                   {
                                     doGet(rq,rp);
                                   }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSOUNDEXFunction</servlet-name>
   <servlet-class>MySqlSOUNDEXFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSOUNDEXFunction</servlet-name>
   <url-pattern>/MySqlSOUNDEXFunction</url-pattern>
</servlet-mapping>

MySql SIN Function in Java Servlet

By Dinesh Thakur

This Function will Returns the sine of numeric expression given in radians.

First i made a database named ‘dbase’ within the reference of mySql(php myAdmin) with required fields and values in it. Then according to need of program, I import all the java packages from the java library. I create a class named ‘MySqlSINFunction’,which extends ‘HttpServlet’. Then i use serviceMethod() that will bring the request from doGet()Method for output on web browser. After using serviceMethod() i loaded all the required Drivers mandatory for database accessing. Here after i declare variables as first i use ‘connection’ this will use to create a link between database and the java code. Then i use ‘resultSet’ this use to get the value from selected columns and rows. And the other one i use is ‘preparedStatement’ this will use to executing the selected Query like executeQuery() as (Select SIN(1)).I use doGet()Method for output on the web browser.

To make output Impressive i use ‘HTML’ tags to get Output in tabular form on a web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSINFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
               {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("Select SIN(1)");
                    rs = ps.executeQuery();
                String title = "Using SIN Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                    "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                    while(rs.next())
                       {
                             String val = rs.getString(1);
                         disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                       }     
               }      
                         catch(Exception e) 
                         {
                                e.printStackTrace();
                         }
                                disp.close();
          }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSINFunction</servlet-name>
   <servlet-class>MySqlSINFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSINFunction</servlet-name>
   <url-pattern>/MySqlSINFunction</url-pattern>
</servlet-mapping>

MySql SIGN Function in Java Servlet

By Dinesh Thakur

This function will return sign of the argument.

First i made a database named ‘dbase’ within the reference of mySql(php myAdmin). Then i import all the required java package from java library according to need of program. Then i made a class named ‘MySqlSIGNFunction’,which extends ‘HTTP SERVLET’ completely. Then after i use service()Method that will bring the request from doGet()Method for output on the web browser.

Then after, i loaded al the required drivers for database accessing. Here i declare variables for next use of program i declare ‘connection’ that will use to create a link between the database and the java code. Here i use ‘resultSet’ that will use to get the value from the selected columns and the rows. At the last instance of declaring variable i use ‘preparedStatement’ that will use to executing the selected Query like executeQuery as (Select SIGN(-8),(8)). I use doGet()Method for output on web browser.

While getting the output on the web browser i use ‘HTML’ code and tag that will bring output in tabular form.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSIGNFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
        {
            rp.setContentType("text/html");
            PrintWriter disp = rp.getWriter();
            String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://localhost/dbase";
            String uid = "root";
            String psw = "root";
            Connection con=null;
            PreparedStatement ps = null;
            ResultSet rs;
            try
             {
                 Class.forName(driver);
                 con = DriverManager.getConnection(url,uid,psw);
                 ps=con.prepareStatement("Select SIGN(-8),(8)");
                 rs = ps.executeQuery();
             String title = "Using SIGN Function";
                 String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                 "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
             "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                  while(rs.next())
                     {
                          String val = rs.getString(1);
                      disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                     }      
             }        
                      catch(Exception e) 
                             {
                        e.printStackTrace();
                         }
                        disp.close();
         }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSIGNFunction</servlet-name>
   <servlet-class>MySqlSIGNFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSIGNFunction</servlet-name>
   <url-pattern>/MySqlSIGNFunction</url-pattern>
</servlet-mapping>

MySql SEC_TO_TIME Function in Java Servlet

By Dinesh Thakur

This Function Will Returns the argument converted to seconds.

First i made a database named ‘dbase’ within the complete reference of mySql(php myAdmin).then i import all the required java package from java library as program need. Then after i made a class named ‘MySqlSecondToTimeFunc’ that is been extends the ‘HttpServlet’. Then i use to get request from doGet()method the serviceMethod() for output on web browser. Then i loaded all the mandatory drivers for database accessing. After then the next move is to declare variables like i use ‘connection’ this will use to make a bridge or link between database and the actual code(java code).After then i use ‘resultSet’ that will be responsible for the getting value from the selected columns and rows. Then i use ‘preparedStatement’ this will use to executing the selected query like executeQuery as (Select SEC_TO_TIME(5200) AS axact). In the last i use doGet() method that will bring the output on the web browser.

While getting Output on the Web Browser we use ‘HTML’ Code or some of these tags to present Output in tabular form. 

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSecondToTimeFunc extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
          {
              rp.setContentType("text/html");
              PrintWriter disp = rp.getWriter();
              String driver = "com.mysql.jdbc.Driver";
              String url = "jdbc:mysql://localhost/dbase";
              String uid = "root";
              String psw = "root";
              Connection con=null;
              PreparedStatement ps = null;
              ResultSet rs;
              try
               {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("Select SEC_TO_TIME(5200) AS axact");
                    rs = ps.executeQuery();
                String title = "Using SEC_TO_TIME Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                    "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Result</th>\n"+ "</body> </html>");
                    while(rs.next())
                       {
                            String curr = rs.getString(1);
                        disp.println("<tr><td align=\"center\">" + curr +"</td></tr>" );  
                       }      
               }      
                        catch(Exception e) 
                        {
                            e.printStackTrace();
                        }
                            disp.close();
          }
                         public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSecondToTimeFunc</servlet-name>
   <servlet-class>MySqlSecondToTimeFunc</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSecondToTimeFunc</servlet-name>
   <url-pattern>/MySqlSecondToTimeFunc</url-pattern>
</servlet-mapping>

MySql Second Function in Java Servlet

By Dinesh Thakur

The function Returns the Seconds from the argument

I made a table in database named ‘dbase’ with required fields and within the reference of mySql(php myAdmin). Then i import all the required java packages from java library. Then i made class, which extends ‘HttpServlet’ named ‘MySqlSecondFunc’. I use here serviceMethod() that will use to getting the request from the doGet ()method. Before declaring desired variables, i loaded all the required drivers for database accessing. Then after, i declare variable like ‘connection’ that will make a link between the database and the actual code. Here i declare ‘resultSet’ Also that is been responsible for the fetching value from the columns and rows. I declare ‘preparedStatement’ that will use to executing selected query like executeQuery() as (Select SECOND(NOW()) AS sc).I use doGet()Method that will get Output on the web browser.

While getting the output on the web browser i use ‘HTML’ code and tag that will bring output in tabular form.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlSecondFunc extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
        {
            rp.setContentType("text/html");
            PrintWriter disp = rp.getWriter();
            String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://localhost/dbase";
            String uid = "root";
            String psw = "root";
            Connection con=null;
            PreparedStatement ps = null;
            ResultSet rs;
            try
              {
                  Class.forName(driver);
                  con = DriverManager.getConnection(url,uid,psw);
                  ps=con.prepareStatement("Select SECOND(NOW()) AS sc");
                  rs = ps.executeQuery();
              String title = "Using SECOND Function";
                  String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                 "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
             "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Result</th>\n"+ "</body> </html>");
                 while(rs.next())
                     {
                           String curr = rs.getString(1);
                       disp.println("<tr><td align=\"center\">" + curr +"</td></tr>" );  
                     }     
            }         
                       catch(Exception e) 
                           {
                             e.printStackTrace();
                           }
                             disp.close();
        }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlSecondFunc</servlet-name>
   <servlet-class>MySqlSecondFunc</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlSecondFunc</servlet-name>
   <url-pattern>/MySqlSecondFunc</url-pattern>
</servlet-mapping>

MySql ROUND Function in Java Servlet

By Dinesh Thakur

This Function Will Returns numeric expression rounded to an integer. Can be use to round an expression to a number of decimal points.

First i make a table in database named ‘dbase’ within the reference of mySql(php myAdmin). Then i import all the required java package from java library. I make a class named ‘MySqlROUNDFunction’ extends the ‘HttpServlet’. I use here serviceMethod() which is use to getting request from the doGet()Method for output. Before activating all the required variable i loaded all the required drivers for the database accessing then after i declare variables like first i declare ‘connection'(this variable will act as to create a link between database and the actual code. Here i declare second one is ‘resultSet’ this will take the responsible for fetching the value from columns and the selected rows. Here i declare one more ‘preparedStatement’ this will use to executing the selected query like executeQuery() as (Select ROUND(8.98)).I use doGet()Method which will bring the output on the web browser.

To getting output in tabular form on web browser, i used ‘HTML’ code and the tags for showing output in manner form also.  

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlROUNDFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
        {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                   Class.forName(driver);
                   con = DriverManager.getConnection(url,uid,psw);
                   ps=con.prepareStatement("Select ROUND(8.98)");
                   rs = ps.executeQuery();
               String title = "Using ROUND Function";
                   String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
               disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                   "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
               "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                   while(rs.next())
                      {
                           String val = rs.getString(1);
                       disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                      }     
              }       
                       catch(Exception e) 
                          {
                           e.printStackTrace();
                          }
                           disp.close();
        }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlROUNDFunction</servlet-name>
   <servlet-class>MySqlROUNDFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlROUNDFunction</servlet-name>
   <url-pattern>/MySqlROUNDFunction</url-pattern>
</servlet-mapping>

MySql RIGHT TRIM Function in Java Servlet

By Dinesh Thakur

This Function will remove trailing spaces.

The First i made a database named ‘dbase’ within the reference of mySql(php myAdmin).Then after i import all java packages from java library as program need. Here i made a class named ‘MySqlRIGHTTRIMFunction’,which extends ‘HttpServlet’. I use service()Method that will help to getting the request from doGet()Method for output on web browser. Then i loaded all the required Drivers that will help to accessing Database. After then i declare variable first i use ‘connection’ variable that will create a link between database and the actual code(frontend and the backend).Other variable is ‘ResultSet’ that will help to fetch value from the columns and rows as required query. The next variable is ‘preparedStatement’ that will use to executing the selected Query like executeQuery as (Select RTRIM(‘JavaMySql ‘) as rtrm).I use doGet()Method in last instance that will bring the output on web browser.

To get output on the web browser i use ‘HTML’ code and tags that will present the output in a tabular form on the web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlRIGHTTRIMFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("Select RTRIM('JavaMySql   ') as rtrm");
                    rs = ps.executeQuery();
                String title = "Using RTrim Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                    "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                    while(rs.next())
                       {
                             String val = rs.getString(1);
                         disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                       }     
               }      
                         catch(Exception e) 
                         {
                            e.printStackTrace();
                         }
                            disp.close();
        }
                         public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlRIGHTTRIMFunction</servlet-name>
   <servlet-class>MySqlRIGHTTRIMFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlRIGHTTRIMFunction</servlet-name>
   <url-pattern>/MySqlRIGHTTRIMFunction</url-pattern>
</servlet-mapping>

MySql RIGHTPAD Function in Java Servlet

By Dinesh Thakur

This Function will return the string argument, right-padded with the specified string.

First of all i made a database named ‘dbase’ within the reference of mySql(php myAdmin).Here i also import required java packages from java library. Then after, i made a class named ‘MySqlRIGHTPADFunction’, which extends ‘HttpServlet’. Then i use service()Method that will bring request from the doGet()Method for output. Just before declaring variable i loaded all the required drivers that are necessary for database accessing. Then after, i use variable as i use ‘connection’ for creating a link between database and java code. Other i use ‘resultSet’ that will do the required job to fetch value from the selected columns and rows. Other one is ‘preparedStatement’ that will use to executing the selected Query like executeQuery() as (Select RPAD(‘MySql’,5,’!!’) as rpad). In the last phase i use doGet()Method that will present output on the web browser.

Now i used some kind of ‘HTML’ code and tags that will present the output in a tabular form on a web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlRIGHTPADFunction extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
       {
           rp.setContentType("text/html");
           PrintWriter disp = rp.getWriter();
           String driver = "com.mysql.jdbc.Driver";
           String url = "jdbc:mysql://localhost/dbase";
           String uid = "root";
           String psw = "root";
           Connection con=null;
           PreparedStatement ps = null;
           ResultSet rs;
           try
            {
                Class.forName(driver);
                con = DriverManager.getConnection(url,uid,psw);
                ps=con.prepareStatement("Select RPAD('MySql',5,'!!') as rpad");
                rs = ps.executeQuery();
            String title = "Using RIGHTPAD Function";
                String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
            disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
            "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                while(rs.next())
                    {
                        String val = rs.getString(1);
                    disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                    }     
            }         
                    catch(Exception e) 
                       {
                        e.printStackTrace();
                       }
                        disp.close();
       }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlRIGHTPADFunction</servlet-name>
   <servlet-class>MySqlRIGHTPADFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlRIGHTPADFunction</servlet-name>
   <url-pattern>/MySqlRIGHTPADFunction</url-pattern>
</servlet-mapping>

MySql RIGHT Function in Java Servlet

By Dinesh Thakur

This Function will return the specified rightmost number of characters.

First we need to make a table with required fields into a database named ‘dbase’ within the reference of MySql(Php MyAdmin).First we need to import all the require packages from the java library. Then we will make a class named ‘MySqlRIGHTFunction’, which extends ‘HttpServlet’. After then we define serviceMethod() which will bring the request from doGet()method for Output. Then we need to declare all the required Drivers for Database linking. Next move will be to declare mandatory variables for accessing the database like Connection variable this variable will make a bridge or link between database and actual code within the help of drivers. The next variable will be the resultSet this will be use to fetch value from the required columns and rows. And the preparedStatement will does the job as it will use to execute the Query like executeQuery() as (Select RIGHT(‘MYSQL’,3)).And in the end the whole criteria goes to doGet()method which will help to getting output on the web browser.

To get output on the web browser I use ‘HTML’ code and tags that will present the output in a tabular form on the web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlRIGHTFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                  Class.forName(driver);
                  con = DriverManager.getConnection(url,uid,psw);
                  ps=con.prepareStatement("Select RIGHT('MYSQL',3)");
                  rs = ps.executeQuery();
              String title = "Using Right Function";
                  String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                  "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
              "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                  while(rs.next())
                     {
                          String val = rs.getString(1);
                      disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                     }     
               }      
                      catch(Exception e) 
                           {
                           e.printStackTrace();
                           }
                           disp.close();
          }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                    {
                                     doGet(rq,rp);
                                    }
  }
WEB.xml
 
<servlet>
   <servlet-name>MySqlRIGHTFunction</servlet-name>
   <servlet-class>MySqlRIGHTFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlRIGHTFunction</servlet-name>
   <url-pattern>/MySqlRIGHTFunction</url-pattern>
</servlet-mapping>

MySql REPLACE Function in Java Servlet

By Dinesh Thakur

This Function will replace occurrences of a specified string.

The First instance i make a table into a database named ‘dbase’ within the reference of mySql(php myAdmin).Then i import all the mandatory java packages from the java library. Then i made a class named ‘MySqlREPLACEFunction’, which extends the ‘HttpServlet’. I use serviceMethod() which is responsible for getting request from the doGet() method for Output on a web browser. After, then i loaded all required drivers that necessary for database accessing. At the next move I declare variable those objects will create a criteria to use database i use ‘connection’ variable (which will be use to create a connection between database and the java code (actual code). The next variable will be the ‘resultSet’ (this will be responsible for getting value from the desired column and rows as required).and the next one will be the ‘preparedStatement’ that will use to executing the query like executeQuery() as (Select REPLACE(‘MYSQL’,’Y’,’YyY’)). At the last instance i use doGet()Method which will use to get output on a web Browser.

I Use ‘HTML’ code and some tags which will show the output in tabular form on the web browser. 

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlREPLACEFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
              rp.setContentType("text/html");
              PrintWriter disp = rp.getWriter();
              String driver = "com.mysql.jdbc.Driver";
              String url = "jdbc:mysql://localhost/dbase";
              String uid = "root";
              String psw = "root";
              Connection con=null;
              PreparedStatement ps = null;
              ResultSet rs;
              try
               {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("Select REPLACE('MYSQL','Y','YyY')");
                    rs = ps.executeQuery();
                String title = "Using Replace Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
               disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                   "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
               "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                   while(rs.next())
                       {
                            String val = rs.getString(1);
                        disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                       }     
               }      
                        catch(Exception e) 
                           {
                           e.printStackTrace();
                           }
                           disp.close();
           }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                   {
                                     doGet(rq,rp);
                                   }
   }
WEB.xml
<servlet>
   <servlet-name>MySqlREPLACEFunction</servlet-name>
   <servlet-class>MySqlREPLACEFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlREPLACEFunction</servlet-name>
   <url-pattern>/MySqlREPLACEFunction</url-pattern>
</servlet-mapping>

MySql REPEAT Function in Java Servlet

By Dinesh Thakur

This function will repeat a string the specified number of times.

First we make a table in database named ‘dbase’ with required fields with in the reference of mySql(php myAdmin). Next step will be to import the required packages from the java library. After then we make a class named ‘MySqlREPEATFunction’, which is, extends the ‘HttpServlet’. And then we use serviceMethod() which will access the granting for getting request from doGet()Method. Then load all the required Drivers. After, that we declare some mandatory variable to access control on the program like Connection (The Connection variable will be used to create a link between the database and the actual code (backend and the frontend). The other variable is resultset this variable is responsible for the fetching value from required columns and rows. And the last variable known as preparedStatement is used to execute the query like executeQuery() as (Select REPEAT(‘MYSQL’,4)).and to present the output we use doGet()Method which provide the output on the Web Browser.

While executing the output on web browser i use ‘HTML’ code and tags that will present the output in tabular form.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlREPEATFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
              rp.setContentType("text/html");
              PrintWriter disp = rp.getWriter();
              String driver = "com.mysql.jdbc.Driver";
              String url = "jdbc:mysql://localhost/dbase";
              String uid = "root";
              String psw = "root";
              Connection con=null;
              PreparedStatement ps = null;
              ResultSet rs;
              try
               {
                   Class.forName(driver);
                   con = DriverManager.getConnection(url,uid,psw);
                   ps=con.prepareStatement("Select REPEAT('MYSQL',4)");
                   rs = ps.executeQuery();
               String title = "Using Repeat Function";
                   String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
              disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                  "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
              "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                  while(rs.next())
                      {
                           String val = rs.getString(1);
                       disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                      }     
              }       
                       catch(Exception e) 
                          {
                          e.printStackTrace();
                          }
                          disp.close();
         }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlREPEATFunction</servlet-name>
   <servlet-class>MySqlREPEATFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlREPEATFunction</servlet-name>
   <url-pattern>/MySqlREPEATFunction</url-pattern>
</servlet-mapping>

MySql REGEXP Function in Java Servlet

By Dinesh Thakur

This function is been used to Check Pattern with regular expressions.

In the first instance of programming i made a database named ‘dbase’ that within the reference of mySql(php myAdmin).Then i import all the required java packages from java library. Then i made a class named ‘MySqlREGEXPFunction’ extends ‘HttpServlet’. I use here service()Method that will getting the request from doGet()Method for output on the web browser. I loaded all the required drivers for database accessing. Here i use variables for database link I use ‘connection’ this will create a link a between database and the java code. I use ‘resultSet’ this will use to get the value from the selected columns and the rows. Then i use ‘preparedStatement’ that will use to executing the query like executeQuery as (SELECT ‘Mysql!’ REGEXP ‘.*’)). I use here doGet()Method for output on the web browser.

To make output manner Form I use ‘HTML’ tags to get Output in tabular form on a web browser.   

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlREGEXPFunction extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
       {
           rp.setContentType("text/html");
           PrintWriter disp = rp.getWriter();
           String driver = "com.mysql.jdbc.Driver";
           String url = "jdbc:mysql://localhost/dbase";
           String uid = "root";
           String psw = "root";
           Connection con=null;
           PreparedStatement ps = null;
           ResultSet rs;
           try
            {
                Class.forName(driver);
                con = DriverManager.getConnection(url,uid,psw);
                ps=con.prepareStatement("SELECT 'Mysql!' REGEXP '.*'");
                rs = ps.executeQuery();
            String title = "Using Regular Expression Function";
                String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
            disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
            "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                while(rs.next())
                   {
                         String val = rs.getString(1);
                     disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                   }     
           }          
                    catch(Exception e) 
                            {
                           e.printStackTrace();
                        }
                           disp.close();
       }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                {
                                     doGet(rq,rp);
                                }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlREGEXPFunction</servlet-name>
   <servlet-class>MySqlREGEXPFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlREGEXPFunction</servlet-name>
   <url-pattern>/MySqlREGEXPFunction</url-pattern>
</servlet-mapping>

MySql RAND Function in Java Servlet

By Dinesh Thakur

This Function will return the Randomly Integer Value.

 First i made a table in database named ‘dbase’ within the reference of mySql(php myAdmin). Then after, I import all the java packages from java library. I made a class named ‘MySqlRANDFunction’, which extends ‘HttpServlet’. I use here the method service()Method that will use to getting the request from the doGet()Method for an output on the web browser. I loaded all the required drivers for accessing the database. I use here variables as required as I use ‘connection’ this variable will create a link between the database and the java code. This variable named ‘resultSet’ will use to get the value from the selected columns and rows from the selected table as required. After that i use to declare ‘preparedStatement’ that will use to executing the Selected query like executeQuery as (Select RAND()). I use doGet()Method for getting output on the web browser.

To get the Output in an impressive look i use some tags of ‘HTML’ Code, which will bring the Output in tabular form on a web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlRANDFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
              rp.setContentType("text/html");
              PrintWriter disp = rp.getWriter();
              String driver = "com.mysql.jdbc.Driver";
              String url = "jdbc:mysql://localhost/dbase";
              String uid = "root";
              String psw = "root";
              Connection con=null;
              PreparedStatement ps = null;
              ResultSet rs;
              try
               {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("Select RAND()");
                    rs = ps.executeQuery();
                String title = "Using RANDOM Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                    "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                    while(rs.next())
                        {
                             String val = rs.getString(1);
                         disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                        }     
              }       
                         catch(Exception e) 
                         {
                             e.printStackTrace();
                         }
                             disp.close();
         }
                        public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlRANDFunction</servlet-name>
   <servlet-class>MySqlRANDFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlRANDFunction</servlet-name>
   <url-pattern>/MySqlRANDFunction</url-pattern>
</servlet-mapping>

MySql RADIANS Function in Java Servlet

By Dinesh Thakur

This Function Returns the value of passed expression converted from degrees to radians.

First i made a table with required fields and values in that into a database named ‘dbase’ with the reference of mySql(php Myadmin). Then i import all the required packages from java library. Then i made a class named ‘MySqlRADIANSFunction’ extends the ‘HttpServlet’. Then i use serviceMethod() which will use to getting request from the doGet()Method for Output. Then load all the required Drivers. Then i declare some mandatory variables like connection (Connection variable is been used to make a bridge or link between database and actual code (java code)). As after creating link between both platforms, i declare resultSet, which will be use to fetch the values from required fields according to user. The other one variable is preparedStatement the object of this variable is ‘ps’ this will use to execute the query like executeQuery() as(Select RADIANS(70)). To in the end i use doGet()Method for getting value on the web Browser.

To get output in tabular form i use some tags from ‘HTML’ that bring the result as desired on web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlRADIANSFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
               {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("Select RADIANS(70)");
                    rs = ps.executeQuery();
                String title = "Using RADIANS Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                    "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                    while(rs.next())
                        {
                              String val = rs.getString(1);
                          disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                        }     
              }       
                          catch(Exception e) 
                          {
                                e.printStackTrace();
                          }
                                disp.close();
         }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlRADIANSFunction</servlet-name>
   <servlet-class>MySqlRADIANSFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlRADIANSFunction</servlet-name>
   <url-pattern>/MySqlRADIANSFunction</url-pattern>
</servlet-mapping>

MySql Quote Function in Java Servlet

By Dinesh Thakur

This Function will use to escape the argument for use in an SQL statement.

I made a table in database named ‘dbase’ with required fields and within the reference of mySql(php myAdmin). Then i import all the required java packages from java library. Then i made class, which extends ‘HttpServlet’ named ‘MySqlQuoteFunction’. I use here serviceMethod() that will use to getting the request from the doGet()method. Before declaring desired variables, i loaded all the required drivers for database accessing. Then after, i declare variable like ‘connection’ that will make a link between the database and the actual code. Here i declare ‘resultSet’ Also which is been responsible for the fetching value from the columns and rows. I declare ‘preparedStatement’ that will use to executing selected query like executeQuery() as (Select QUOTE(‘MySql!’)). I use doGet()Method that will get Output on the web browser.

Now on the browser to get an output in designer look we just use the ‘HTML’ code tags, which will present the Output in Tabular form for an efficient look.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlQuoteFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
               {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("Select QUOTE('MySql!') as qt");
                    rs = ps.executeQuery();
                String title = "Using Quote Function";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
               disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                    "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                    while(rs.next())
                         {
                              String val = rs.getString(1);
                          disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                         }     
               }      
                         catch(Exception e) 
                         {
                            e.printStackTrace();
                         }
                            disp.close();
          }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                 {
                                     doGet(rq,rp);
                                 }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlQuoteFunction</servlet-name>
   <servlet-class>MySqlQuoteFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlQuoteFunction</servlet-name>
   <url-pattern>/MySqlQuoteFunction</url-pattern>
</servlet-mapping>

MySql Quarter Function in Java Servlet

By Dinesh Thakur

This Function will Returns the quarter from a date argument.

I made a table in database named ‘dbase’ with required fields and values too. The database made within the reference of mySql(php myAdmin). Then i import all the required java packages from java library with required Condition. I made a class named ‘MySqlQuarterFunc’, which extends ‘HttpServlet’. Here now i use serviceMethod() which will act a role of getting request from doGet()Method for output. Before declaring the variable, i load here all required drivers for the database accessing. Here now time to declaring the variables i declare ‘connection’ this variable will use to create the link between database and the actual code. The other i declare is ‘resultSet’ this will use to fetch the value from required columns and rows as required condition. Here i also declare ‘preparedStatement’ this will get in the use to executing the selected Query like executeQuery as (Select QUARTER(‘2014-05-31’)).Here in the last instance of coding i just use doGet()method which will bring the output on the web browser.

I use here ‘Html’ code and tags that will present the output in tabular form on the web browser.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlQuarterFunc extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                  Class.forName(driver);
                  con = DriverManager.getConnection(url,uid,psw);
                  ps=con.prepareStatement("Select QUARTER('2014-05-31') AS qt");
                  rs = ps.executeQuery();
              String title = "Using Quarter Function";
                  String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
              disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                  "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
              "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Result</th>\n"+ "</body> </html>");
                  while(rs.next())
                      {
                            String curr = rs.getString(1);
                        disp.println("<tr><td align=\"center\">" + curr +"</td></tr>" );  
                     }     
             }        
                         catch(Exception e) 
                         {
                             e.printStackTrace();
                         }
                             disp.close();
        }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlQuarterFunc</servlet-name>
   <servlet-class>MySqlQuarterFunc</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlQuarterFunc</servlet-name>
   <url-pattern>/MySqlQuarterFunc</url-pattern>
</servlet-mapping>

MySql Precedence Rule in Java Servlet

By Dinesh Thakur

The Computation of Operator Precedence rule Condition.

First i made a table named ‘reg’ into a database named ‘dbase’ within the reference of mySql(php myAdmin). In the starting of Program, we need to import all the Required Packages from the java library. Then to declare a class named ‘MySqlPrecedenceRule’ which is been extends ‘HttpServlet’. After then we have to use serviceMethod() which is responsible for the Getting request for Output. Then load drivers and create an Object of resultSet which, will useful to show the table result as an Output. Connection variable also to be declare for interact between database and actual code as like in between frontend and backend. Now on other hand preparedStatement will be use for executing query like executeQuery() as (SELECT last_name, job_id, salary FROM reg WHERE job_id = ‘it_prog’OR job_id = ‘manager’AND salary > 12000). And to fetch the result on web browser doGet() method will be initialize.

To feel look good the result we use a tabular form concept. For this kind of requirement, we use ‘HTML’ coding and some of tags to use Output in Designer look to show on a web browser. 

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlPrecedenceRule extends HttpServlet
   {
        public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
               {
                    Class.forName(driver);
                    con = DriverManager.getConnection(url,uid,psw);
                    ps=con.prepareStatement("SELECT last_name, job_id, salary FROM reg WHERE job_id = 'it_prog'OR job_id = 'manager'AND salary > 12000");
                    rs = ps.executeQuery();
                String title = "Employee's Info With Using of Precedence Rule Query";
                    String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                     "<body bgcolor=\"#f4efef\">\n" + "<h3 align=\"center\">" + title + "</h3>\n" + "<ul>\n" +
                 "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Last Name</th><th>Job Id</th><th>Salary</th>\n"+ "</body> </html>");
                     while(rs.next())
                           {
                                   String l_name = rs.getString("last_name");
                           String j_id=rs.getString("job_id");
                           int sal=rs.getInt("salary");
                           disp.println("<tr><td align=\"center\">" + l_name +"<td align=\"center\">" + j_id +"<td align=\"center\">" + sal +"</td></tr>" );           
                           }     
            }         
                               catch(Exception e) 
                               {
                                    e.printStackTrace();
                               }
                                    disp.close();
         }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlPrecedenceRule</servlet-name>
   <servlet-class>MySqlPrecedenceRule</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlPrecedenceRule</servlet-name>
   <url-pattern>/MySqlPrecedenceRule</url-pattern>
</servlet-mapping>

MySql POW Function in Java Servlet

By Dinesh Thakur

This Function will Returns the value of one expression raised to the power of another expression.

First i made a database named ‘dbase’ within the complete reference of mySql(php myAdmin).Then i import all the required java package from java library as program need. Then after i made a class named ‘MySqlPOWFunction’ that is been extends the ‘HttpServlet’. Then i use to get request from doGet()method the serviceMethod() for output on web browser. Then i loaded all the mandatory drivers for database accessing. After then the next move is to declare variables like i use ‘connection’ this will use to make a bridge or link between database and the actual code(java code).after then i use ‘resultSet’ that will be responsible for the getting value from the selected columns and rows. Then i use ‘preparedStatement’ this will use to executing the selected query like executeQuery as (Select POW(7,2)). In the last i use doGet() method that will bring the output on the web browser.

To get output on the web browser i use ‘HTML’ code and tags which present it in tabular form.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlPOWFunction extends HttpServlet
   {
       public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
         {
             rp.setContentType("text/html");
             PrintWriter disp = rp.getWriter();
             String driver = "com.mysql.jdbc.Driver";
             String url = "jdbc:mysql://localhost/dbase";
             String uid = "root";
             String psw = "root";
             Connection con=null;
             PreparedStatement ps = null;
             ResultSet rs;
             try
              {
                   Class.forName(driver);
                   con = DriverManager.getConnection(url,uid,psw);
                   ps=con.prepareStatement("Select POW(7,2)");
                   rs = ps.executeQuery();
               String title = "Using POW Function";
                   String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
               disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                   "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
               "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                   while(rs.next())
                      {
                            String val = rs.getString(1);
                        disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                      }     
              }       
                        catch(Exception e) 
                        {
                            e.printStackTrace();
                        }
                            disp.close();
         }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlPOWFunction</servlet-name>
   <servlet-class>MySqlPOWFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlPOWFunction</servlet-name>
   <url-pattern>/MySqlPOWFunction</url-pattern>
</servlet-mapping>

MySql POWER Function in Java Servlet

By Dinesh Thakur

This Function will Returns the value of one expression raised to the power of another expression.

First i made a database named ‘dbase’ within the complete reference of mySql(php myAdmin). Then i import required java package from java library as program need. Then after i made a class named ‘MySqlPOWERFunction’ that is been extends the ‘HttpServlet’. Then i use to get request from doGet()method the serviceMethod() for output on web browser. Then i loaded all the mandatory drivers for database accessing. After then the next move is to declare variables like i use ‘connection’ this will use to make a bridge or link between database and the actual code(java code).After then i use ‘resultSet’ that will be responsible for the getting value from the selected columns and rows. Then i use ‘preparedStatement’ this will use to executing the selected query like executeQuery as (Select POWER(8,2)). In the last i use doGet() method that will bring the output on the web browser.

To get output on the web browser i use ‘HTML’ code and tags which present it in tabular form.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlPOWERFunction extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
       {
           rp.setContentType("text/html");
           PrintWriter disp = rp.getWriter();
           String driver = "com.mysql.jdbc.Driver";
           String url = "jdbc:mysql://localhost/dbase";
           String uid = "root";
           String psw = "root";
           Connection con=null;
           PreparedStatement ps = null;
           ResultSet rs;
           try
            {
                 Class.forName(driver);
                 con = DriverManager.getConnection(url,uid,psw);
                 ps=con.prepareStatement("Select POWER(8,2)");
                 rs = ps.executeQuery();
             String title = "Using POWER Function";
                 String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                 "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
             "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                 while(rs.next())
                     {
                          String val = rs.getString(1);
                      disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                     }     
            }         
                      catch(Exception e) 
                                {
                            e.printStackTrace();
                        }
                            disp.close();
       }
                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                  {
                                     doGet(rq,rp);
                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlPOWERFunction</servlet-name>
   <servlet-class>MySqlPOWERFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlPOWERFunction</servlet-name>
   <url-pattern>/MySqlPOWERFunction</url-pattern>
</servlet-mapping>

MySql POSITION Function in Java Servlet

By Dinesh Thakur

This Function is A synonym for LOCATE () Function.

First, i use to make a database named ‘dbase’ within the reference of mySql(php myAdmin). Then i use to import all required java package from java library. Then after calling all the packages i made a class named ‘MySqlPOSITIONFunction’,which extends ‘HttpServlet’. I use service()Method which will use to getting the request from doGet()Method for output. Then i loaded all the required drivers for database accessing. After loading driver, i declare the variables as i use ‘connection’ variable that will use to create a link between the database and the java code. Then after, i use ‘resultSet’ that will act as to fetching value from the selected column and rows. I use ‘preparedStatement’ that will use to executing the selected query like executeQuery as (Select POSITION(‘Sql’IN’MySqlJava’)). I use doGet()Method in last interface which will use to get output on the web browser.

To Getting Output on web browser in a tabular form i use ‘HTML’ code and tags.

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlPOSITIONFunction extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
        {
            rp.setContentType("text/html");
            PrintWriter disp = rp.getWriter();
            String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://localhost/dbase";
            String uid = "root";
            String psw = "root";
            Connection con=null;
            PreparedStatement ps = null;
            ResultSet rs;
            try
             {
                 Class.forName(driver);
                 con = DriverManager.getConnection(url,uid,psw);
                 ps=con.prepareStatement("Select POSITION('Sql'IN'MySqlJava') as pstn");
                 rs = ps.executeQuery();
                             String title = "Using POSITION Function";
                 String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                  "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                              "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value Is </th>\n"+ "</body> </html>");
                 while(rs.next())
                     {
                           String val = rs.getString(1);
                                       disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                     }     
             }            
                                       catch(Exception e) 
                                    {
                                        e.printStackTrace();
                                    }
                                        disp.close();
       }
                                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                                  {
                                                 doGet(rq,rp);
                                                  }
   }
WEB.xml
 
<servlet>
   <servlet-name>MySqlPOSITIONFunction</servlet-name>
   <servlet-class>MySqlPOSITIONFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlPOSITIONFunction</servlet-name>
   <url-pattern>/MySqlPOSITIONFunction</url-pattern>
</servlet-mapping>

MySql PI Function in Java Servlet

By Dinesh Thakur

This Function Will Returns the value of pi.

i made a database first named ‘dbase’ within the reference of mySql(php myAdmin). Then i import all the required java packages from the java library. Here after, i made a class named ‘MySqlPIFunction’, which extends ‘HttpServlet’ Completely. Then i use service()Method that will help to getting request from the doGet()Method for output. After that, i loaded all the required drivers that are useful for database accessing. Then i declare the mandatory drivers as i use ‘connection’ variable that will use to create a link between database and java code. After that i declare ‘resultSet()that will use to get value from the columns and rows as selected table. Here after i use to declare ‘preparedStatement’ that will act as to executing selected query like executeQuery() as (Select PI()). In the last i use doGet()Method which will bring the output on the web browser.

On the web Browser i use ‘Html’ tags to print the output in tabular form on the web browser this will present output in a manner way. 

 import java.io.IOException; 
import java.io.PrintWriter;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MySqlPIFunction extends HttpServlet
   {
      public void service(HttpServletRequest rq, HttpServletResponse rp)throws IOException, ServletException
       {
           rp.setContentType("text/html");
           PrintWriter disp = rp.getWriter();
           String driver = "com.mysql.jdbc.Driver";
           String url = "jdbc:mysql://localhost/dbase";
           String uid = "root";
           String psw = "root";
           Connection con=null;
           PreparedStatement ps = null;
           ResultSet rs;
           try
             {
                 Class.forName(driver);
                 con = DriverManager.getConnection(url,uid,psw);
                 ps=con.prepareStatement("Select PI()");
                 rs = ps.executeQuery();
                             String title = "Using PI Function";
                 String docType ="<!doctype html public \"-//w3c//dtd html 4.0 " + "transitional//en\">\n";
                             disp.println(docType + "<html>\n" + "<head><title>" + title + "</title></head>\n" +
                 "<body bgcolor=\"#f4efef\">\n" + "<h1 align=\"center\">" + title + "</h1>\n" + "<ul>\n" +
                             "<table width=\"50%\" border=\"1\" align=\"center\">\n" + "<th>Value</th>\n"+ "</body> </html>");
                 while(rs.next())
                     {
                          String val = rs.getString(1);
                                      disp.println("<tr><td align=\"center\">" + val +"</td></tr>" );  
                     }     
             }            
                                      catch(Exception e) 
                                         {
                                      e.printStackTrace();
                                         }
                                      disp.close();
         }
                                       public void doPost(HttpServletRequest rq,HttpServletResponse rp)throws IOException,ServletException
                                                  {
                                                 doGet(rq,rp);
                                                  }
   }
 
WEB.xml
 
<servlet>
   <servlet-name>MySqlPIFunction</servlet-name>
   <servlet-class>MySqlPIFunction</servlet-class>
</servlet>
<!-- servlet mapping -->
<servlet-mapping>
   <servlet-name>MySqlPIFunction</servlet-name>
   <url-pattern>/MySqlPIFunction</url-pattern>
</servlet-mapping>
« Previous Page
Next Page »

Primary Sidebar

Servlet Tutorials

Servlet Tutorials

  • Servlet - Home
  • Servlet - Types
  • Servlet - Advantages
  • Servlet - Container
  • Servlet - API
  • Servlet - Chaining
  • Servlet - Life Cycle
  • Servlet - Developement Way
  • Servlet - Servlet Vs CGI
  • Servlet - Server Side
  • Servlet - HttpServletRequest
  • Servlet - Cookies Advantages
  • Servlet - JDBC Architecture
  • Servlet - HttpServlet
  • Servlet - HttpServletResponse
  • Servlet - Web Technology
  • Servlet - Applet Communication
  • Servlet - Html Communication
  • Servlet - HTTP POST Request
  • Servlet - HTTP GET Request

Other Links

  • Servlet - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW