Watch “JSP Part-2 | JSP Login example (Gujarati)” on YouTube

Jdk #Java #JSP #JavaServerPages #Scriplet #Delimiters #JSPLogin #LoginExampleUsingJSP #Gujarati #RaviROza

Video features the combination of following

  • Scriplet tag example in JSP
  • Expression tag example in JSP
  • Comment tag example in JSP

Following are the files used in the JSP login example

  • index.jsp
  • login.jsp
  • welcome.jsp
  • sorry.jsp

Overall process of example:
index.jsp page contains user interface to accept username and password from client side, when client submits the control transfer to the login.jsp file which contains the logic to validate username and password. If the client information is validated the control is transfer to welcome.jsp otherwise to sorry.jsp.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “JSP Part-1 | Java Server Pages – Introduction (Gujarati)” on YouTube

Jdk #Java #JSP #JavaServerPages #Scriplet #Delimiters #Gujarati #RaviROza

JSP is a server side scripting language
It is based on java language and enable the development of dynamic web page.

JSP files are HTML files with special tag containing java source code that provide dynamic content.

It is used to create web app, focuses more on presentation logic.

JSP is easier to maintain than a Servlet.
Servlet adds HTML code inside Java code, while JSP adds Java code inside HTML.

OS : Windows 10
Jdk : Version 8

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Introduction to RMI – Remote Method Invocation (Gujarati)” on YouTube

RMI #RemoteMethodInvocation #Jdk #Java #Gujarati #RemoteProcedureCall #Stub #Skeleton #RaviROza

RMI Introduction:

RMI is an API that provides a mechanism to develop distributed app, objects on different computers can interact in a distributed network.
It allows an object to invoke methods on an object running in another JVM.
RMI is the Java version of what is generally known as a remote procedure call (RPC), but with the ability to pass one or more objects along with the request.
The object can include information that will change the service that is performed in the remote computer.
The RMI provides remote communication between the applications using two objects stub and skeleton.

  • various sources

OS : Windows 10
Jdk : Version 8

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part 21 | CRUD operation in Servlet Using JDBC (Gujarati)” on YouTube

#CRUD #Servlet #JDBC #MySql #Eclipse #MySqlWorkbench #ApacheTomcat #Jdk #Java

This video features the CRUD operation using JDBC via servlet only, no JSP page is used to perform any database operation.
CRUD is Create, Read, Update & Delete.

Index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Servlet with JDBC</title>
</head>
<body>
<form action="AddEmp" method="post">
<h1> Employee Management</h1>
<p> Enter Emp. No : <input type="text" name="txtEno"> </p>
<p> Enter Emp. Name : <input type="text" name="txtEname"> </p>
<p> Enter Emp. Salary : <input type="text" name="txtEsalary"> </p>

<p> DB Operation :
<select name="op">
    <option value="1">Add</option>
    <option value="2">Update</option>
    <option value="3">Delete</option>
    <option value="4">Display</option>
</select>
</p>

<p> <input type="submit" value="Submit"> </p>
</form>
</body>
</html>

AddEmp.java

package servletWithJDBC;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;

@WebServlet("/AddEmp")
public class AddEmp extends HttpServlet 
{
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{			
		response.setContentType("text/html");
		PrintWriter pw = response.getWriter();
		String op = request.getParameter("op");
		Connection conn;
		PreparedStatement pst=null; 
		String url,username,password,qry="";
		url = "jdbc:mysql://localhost:3306/raviroza";
		username="root";
		password="ravi";	
		
		int eno;
		String ename="";
		float esalary;
		try 
		{
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection(url,username,password);			
			
			if(op.equals("1"))
			{
				eno = Integer.parseInt(request.getParameter("txtEno"));
				ename = request.getParameter("txtEname");
				esalary = Float.parseFloat(request.getParameter("txtEsalary"));
				
				qry = "insert into emp values (?,?,?)";
				pst = conn.prepareStatement(qry);
				pst.setInt(1, eno);
				pst.setString(2, ename);
				pst.setFloat(3, esalary);
				pst.executeUpdate();
			}
			else if(op.equals("2"))
			{
				eno = Integer.parseInt(request.getParameter("txtEno"));
				ename = request.getParameter("txtEname");
				esalary = Float.parseFloat(request.getParameter("txtEsalary"));
				
				qry = "update emp set ename=?,esalary=? where eno=?";
				pst = conn.prepareStatement(qry);				
				pst.setString(1, ename);
				pst.setFloat(2, esalary);
				pst.setInt(3, eno);
				pst.executeUpdate();
			}
			else if(op.equals("3"))
			{
				eno = Integer.parseInt(request.getParameter("txtEno"));
				qry = "delete from emp where eno=?";	
				pst = conn.prepareStatement(qry);								
				pst.setInt(1, eno);
				pst.executeUpdate();
			}								
						
			qry = "select * From Emp Order by eno desc";
			ResultSet rs = conn.prepareStatement(qry).executeQuery();
			pw.println("<table border=1>");
			pw.println("<th>Eno.</th>");
			pw.println("<th>Emp. Name</th>");
			pw.println("<th>Emp. Salary</th>");
			while(rs.next())
			{
				pw.println("<tr>");
				pw.println("<td>"+rs.getString("eno")+"</td>");
				pw.println("<td>"+rs.getString("ename")+"</td>");
				pw.println("<td>"+rs.getString("esalary")+"</td>");
				pw.println("</tr>");
			}
						
			pw.println("<h2> Employee Info. updated Successfully ! </h2>");
			pw.println("<a href='index.html'>Back</a>");
			
			pw.close();
			pst.close();
			conn.close();		
		}
		catch (ClassNotFoundException | SQLException e) 
		{
			pw.println("<h2> Driver|SQL Error "+e.toString() +"</h2>");
		}
	}
}

Overall process of example.

It is generally the table operation to create, access, manipulate, and delete the data from a database table.
Here, only a single Servlet is performing all the CRUD operation. Operation is decided by the client by selecting a proper option from list of choices.

When a client/user select the “Add” option, the internal value of that option is checked to perform the add operation, like wise when user/client select the “Update” operation the record is updated with given details.

If user/client decide to delete the record the valid number is given and the delete operation is carried.

Finally, if user decides to display all the record there is an option called “Display” to view all the details of the table.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Database : MySQL using MySql Workbench 5.2 CE
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-16 | How to use Cookies in Servlet (Gujarati)” on YouTube

Video features introduction to Session management.
To track the user session various session tracking approaches are there in servlet.
Here, the Cookies is discussed with suitable example. Index page is used to read user’s name from the client, at the server side there are three servlets. First servlet receives the input/request from the index page, then the session information added using Cookies, then the second servlet also adds the session information in the second servlet using Cookies, and finally third servlet gets the client session information from second servlet.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part-20 | Servlet with JDBC (Gujarati)” on YouTube

#CRUD #Servlet #JDBC #MySql #Eclipse #MySqlWorkbench #ApacheTomcat #Jdk #Java

This video contains the steps and demonstration to define servlet with JDBC using eclipse to connect with MySql database.

Steps to create it.

  1. Create a dynamic web project in eclipse
  2. Configure build path to add database driver (jar files)
  3. Add dependency (database jar file) to projects lib folder
  4. Create in html/jsp page for client
  5. Create a servlet to handle client request
  6. Define JDBC steps to handle database operation in servlet

Project contains JDBC operation such as loading driver, creating connection and adding employee details using prepared statement.

Subscribe channel to get notification of my next video related to database operation such as update, delete, and select.

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Database : MySQL using MySql Workbench 5.2 CE
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101

Watch “Servlet Part 19 | How to use HttpSession in Servlet – Revised (Gujarati)” on YouTube

Video features introduction to Session management.
To track the user session various session tracking approaches are there in servlet.
Here, the HttpSession is discussed with suitable example.
Index page is used for multiple purpose, here i have define two forms which are referring to same form, but with different method type. First form is referring to doGet method whereas later referring to doPost methods.
With doGet method session is defined and doPost method is used to retrieve session the session and its attributes.
Following are the list of files used in the example (index.html, LoginServlet.java).

OS : Windows 10
Jdk : Version 8
IDE : Eclipse Mars
Server : Apache Tomcat 7

follow me @
https://raviroza.wordpress.com/
https://twitter.com/raviozaIT
https://www.facebook.com/ravi.oza.it

Subscribe my channel to get latest video notification https://www.youtube.com/user/ravioza101