Watch “JSP Part-18 | JSP JDBC with CRUD (Update operation) (Gujarati)” on YouTube

JSP with Bean and Data access object (DAO). JSP is the normal jsp page which uses the bean to store employee information. The DAO file also know an Data Access Layer of our application, contains the code perform database operations such as add, change, delete etc.,

This video demonstrates the best usage of MVC (Model View & Controller) architecture in Java.
➡️ The model here is the EmpBean which holds the employee information.
➡️ The index page is the View which is interface used by client to enter the input and get to view the output.
➡️ The controller here the file which accepts the request from client and sets to bean and bean finally manages the database operation.

CRUD – Create, Read, Update & Delete

With reference to previous video 👉 https://youtu.be/63cIEAnz7Hc which consist of Add operation & Display operation.
and 👉 https://youtu.be/Asi4H3QCHY4 which consist of Delete operation.

In this video the same example has been extended to support Edit/Update operation using display page. The link (url to edit page and ID of record to be updated) has been generated in the display page for to update record.

Once user click the Edit link , the control is transfer to edit.jsp page, where the the ID of the record to be updated is fetch from request object and the other details are set in text boxes so that user can edit the data.

There is a Update (submit) button which transfer user control to the update.jsp page, where all the submitted data is updated into emp table.

RaviROza #MVC #JSPJDBC #CRUD #DAO #AdvanceJava #Jdk #Java #Gujarati

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

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

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

Watch “JSP Part-17 | JSP JDBC with CRUD (Delete operation) (Gujarati)” on YouTube

JSP with Bean and Data access object (DAO). JSP is the normal jsp page which uses the bean to store employee information. The DAO file also know an Data Access Layer of our application, contains the code perform database operations such as add, change, delete etc.,

This video demonstrates the best usage of MVC architecture in Java.
➡️ The model here is the EmpBean which holds the employee information.
➡️ The index page is the View which is interface used by client to enter the input and get to view the output.
➡️ The controller here the file which accepts the request from client and sets to bean and bean finally manages the database operation.

CRUD – Create, Read, Update & Delete.

With reference to previous video 👉 https://youtu.be/63cIEAnz7Hc which consist of Add operation & Display operation.

In this video the same example has been extended to support Delete operation using display page. The link (url to delete page and ID of record to be deleted) has been generated in the display page for to delete record.

Once user click the Delete link , the control is transfer to delete.jsp page, where the the ID of the record to be deleted is fetch from request object and the same will be deleted from the emp table.

RaviROza #MVC #JSPJDBC #CRUD #DAO #AdvanceJava #Jdk #Java #Gujarati

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

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

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

Watch “JSP Part-16 | JSP JDBC with Bean and DAO (Gujarati)” on YouTube

JSP with Bean and Data access object (DAO). JSP is the normal jsp page which uses the bean to store employee information. The DAO file also know an Data Access Layer of our application, contains the code perform database operations such as add, change, delete etc.,

This video demonstrates the best usage of MVC architecture in Java.
➡️ The model here is the EmpBean which holds the employee information.
➡️ The index page is the View which is interface used by client to enter the input and get to view the output.
➡️ The controller here the file which accepts the request from client and sets to bean and bean finally manages the database operation.

RaviROza #MVC #JSPJDBC #DAO #AdvanceJava #Jdk #Java #Gujarati

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

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

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

Watch “JSP Part-14 | MVC in JSP with example (Gujarati)” on YouTube

RaviROza JSPImplictObjects #jsp:UseBean #Jdk #Java #AdvanceJava #Gujarati

Model View & Controller
▶️ It is a design pattern that separates the business logic, presentation logic and data.
▶️ Model represents the state of the application i.e. data. It can also have business logic. (Data & business logic)
▶️ View represents the presentation i.e. UI (User Interface).
▶️ Controller acts as an interface between View and Model. Controller intercepts all the incoming requests. (Controller is a request handler)

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

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

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

Watch “JSP Part-13 | Model View & Controller – MVC Architecture (Gujarati)” on YouTube

RaviROza JSPImplictObjects #jsp:UseBean #Jdk #Java #AdvanceJava #Gujarati

Model View & Controller
▶️ It is a design pattern that separates the business logic, presentation logic and data.
▶️ Model represents the state of the application i.e. data. It can also have business logic. (Data & business logic)
▶️ View represents the presentation i.e. UI (User Interface).
▶️ Controller acts as an interface between View and Model. Controller intercepts all the incoming requests. (Controller is a request handler)

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

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

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

Watch “JSP Part-12 | Implicit object, use bean & Error page revision (Gujarati)” on YouTube

RaviROza JSPImplictObjects #jsp:UseBean #Jdk #Java #AdvanceJava #Gujarati

JSP Application object:
▶️ It represents the context within which the JSP is executing.
▶️ It has application scope.
▶️The application object represents the application to which the JSP is executing to which the JSP page belongs.
▶️ It is an instance of the javax.servelt.ServletContext.

JSP Config object:
▶️ config is an implicit object of type ServletConfig.
▶️ This object can be used to get initialization parameter for a particular JSP page.
▶️ The config object is created by the web container for each jsp page.

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

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

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

Watch “JSP Part-11 | JSP Implicit Objects with example (Gujarati)” on YouTube

RaviROza JSPImplictObjects #Jdk #Java #AdvanceJava #Gujarati

JSP Application object:
▶️ It represents the context within which the JSP is executing.
▶️ It has application scope.
▶️The application object represents the application to which the JSP is executing to which the JSP page belongs.
▶️ It is an instance of the javax.servelt.ServletContext.

JSP Config object:
▶️ config is an implicit object of type ServletConfig.
▶️ This object can be used to get initialization parameter for a particular JSP page.
▶️ The config object is created by the web container for each jsp page.

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

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

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

Watch “JSP Part-10 Implicit Object, Scope of JSP Variables” on YouTube

#Java #JSP #ImplicitObjectsinJSP #ScopeofJSPVariables #jsp:useBean #RaviROza

There are 9 jsp implicit objects.

These objects are created by the web container  that are available to all the jsp pages.

some commonly used objects for servlets that JSP page developers might need to use are:

  • request
  • response
  • out
  • session
  • application
  • config
  • pageContext
  • page
  • exception

Scope of jsp varibles

  • application
  • session
  • request
  • page

How to deal with exception in JSP by:

  • using page directive
  • using deployment descriptor (web.xml) file

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

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

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

Watch “JSP Part-9 | Use Bean Example-3 (Gujarati)” on YouTube

#Java #JSP #jsp:useBean #RaviROza

jsp:use bean tag is used to declare and used object using tag format in jsp page.

Bean object is declared using use:bean tag in jsp page. set:property tag is used to set the values and get:property tag used to get the values from bean object.

Scope for jsp:bean is set to request so that when a request is transfer to another page its also accessible there.

following is the list of important attributes of jsp:usebean tag
➡ id (name of the object)
➡ name (name of the fully qualified class name of bean)
➡ scope (application,request,session and page), default is page.

In this example bean values are set in process.jsp and then its transferred to welcome.jsp using request dispatcher. Welcome.jsp access the values get the values which were set in process.jsp page.

Summary of files used in this example
➡️ index.jsp (to accept client input)
➡️ process.jsp (to declare and set the values in bean)
➡️ UserBean.java (user bean POJO file)
➡️ welcome.jsp (welcome page to display)

Index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP Static Login using Bean</title>
</head>
<body>

<form action="process.jsp">

Username : <input type="text" name="txtUser">
Password :  <input type="password" name="txtPass">
<input type="submit">
</form>

</body>
</html>

process.jsp

<%@page import="com.raviroza.beans.UserBean"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP : Using Beans</title>
</head>
<body>

<jsp:useBean id="hjd" class="com.raviroza.beans.UserBean" scope="request">
</jsp:useBean>

<jsp:setProperty 
property="username" name="hjd" 	value='<%=request.getParameter("txtUser") %>'/>
	
<jsp:setProperty 	
property="password" name="hjd"	value='<%=request.getParameter("txtPass") %>' />
	
<%
	RequestDispatcher rd = request.getRequestDispatcher("welcome.jsp");
 	rd.forward(request, response);
%>
</body>
</html>

UserBean.java

package com.raviroza.beans;

public class UserBean implements java.io.Serializable 
{
	private String username,password;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}	
	public boolean validate()
	{
		if(username.equals("admin") && password.equals("admin"))
		{
			return true;
		}
		else 
		{
			return false;
		}
	}
}

welcome.jsp

<%@page import="com.raviroza.beans.UserBean"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome</title>
</head>
<body>
<h1>Welcome Page</h1>

<jsp:useBean id="hjd" class="com.raviroza.beans.UserBean" scope="request">
</jsp:useBean>

Hello,
<p>User name : <jsp:getProperty property="username" name="hjd"/>

<p>Password : <jsp:getProperty property="password" name="hjd"/>

</body>
</html>

Output

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

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

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

Watch “JSP Part-8 | Use Bean Example-2 (Gujarati)” on YouTube

#Java #JSP #jsp:useBean #RaviROza

It contains the following files
👉 Index.jsp
👉 load.jsp
👉 StudentBean.java
👉 welcome.jsp

Index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>use Bean Example</title>
</head>
<body>

<form action="load.jsp">
	<p>Enter Student No
	<input type="text" name="t1">
	<p>Enter Student Name
	<input type="text" name="t2">	
	<p>
	<input type="submit">
</form>
</body>
</html>

load.jsp

<%@page import="raviroza.StudentBean"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
	<%
		int 	 id  = Integer.parseInt(request.getParameter("t1"));
		String name = request.getParameter("t2");
		
 		StudentBean st1 = new StudentBean();
 		st1.setSid(id);
 		st1.setSname(name);
		
// 		request.setAttribute("p1", id);
// 		request.setAttribute("p2", name);
		
// 		out.println("<p>"+st1.getSid());
// 		out.println("<p>"+st1.getSname());
		
		request.setAttribute("st1", st1);
		
		RequestDispatcher rd = request.getRequestDispatcher("welcome.jsp");
		rd.forward(request, response);
		//response.sendRedirect("welcome.jsp");		
	%>	
</body>
</html>

StudentBean.java

package raviroza;

public class StudentBean implements java.io.Serializable 
{
	private int Sid;
	private String Sname;
	
	public int getSid() {
		return Sid;
	}
	public void setSid(int sid) {
		Sid = sid;
	}
	
	public String getSname() {
		return Sname;
	}
	public void setSname(String sname) {
		Sname = sname;
	}			
}

welcome.jsp

<%@page import="raviroza.StudentBean"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>welcome</title>
</head>
<body>
<h1> Welcome to the home page</h1>
<%
	StudentBean st = new StudentBean();
	st = (StudentBean) request.getAttribute("st1");
	
	out.println(st.getSid());
	out.println(st.getSname());
%>

<%-- <%=request.getAttribute("p1").toString() %> --%>
<%-- <%=request.getAttribute("p2").toString() %> --%>
</body>
</html>

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

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

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