 id="ob" class="sample.Database" scope="session" />
<%
    String n=request.getParameter("name");
    if(ob.checkName(n)==0)
    {
%>
        <font color=green>Available</font>
<%
    }
    else
    {
%>
        <font color=red>Not available</font>
<%
    }
%>

now sample1.jsp....
<jsp:useBean id="ob" class="sample.Database" scope="session" />
<jsp:setProperty name="ob" property="*" />
<%
    if(ob.insertData()==1)
        out.println("Success");
    else

        out.println("Unsuccess");
%>

code for class file in package->sample  filename->Database.java...
package sample;

import java.util.*;
import java.sql.*;

public class Database
{
    private String id="",name="";
    private int t=0;
    private Connection con;

    public void setName(String name)
    {
        this.name=name;
    }

    public String getName()
    {
        return name;
    }

    public void setId(String id)
    {
        this.id=id;
    }

    public String getId()
    {
        return id;
    }

    public Connection c1()
    {
        try{
            Class.forName("oracle.jdbc.OracleDriver");
            con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1000:xe","system","12345");
        }
        catch(Exception e){}
        return con;
    }

    public int checkName(String n)
    {
        try{
            con=c1();
            PreparedStatement pst = con.prepareStatement("select name from testani where name='"+n+"'");
            t = pst.executeUpdate();
            con.close();
        }
        catch(Exception e){}
        return t;
    }

    public int insertData()
    {
        try{
            con=c1();
            PreparedStatement
id="ob " class="sample. Database " scope="session " / > 
 <% 
     String n = request.getParameter("name "); 
     if(ob.checkName(n)==0) 
     { 
% > 
         < font color = green > Available</font > 
 <% 
     } 
     else 
     { 
% > 
         < font color = red > Not available</font > 
 <% 
     } 
% > 

 nowadays sample1.jsp.... 
 < jsp: useBean id="ob " class="sample. Database " scope="session " / > 
 < jsp: setProperty name="ob " property= " * " / > 
 <% 
     if(ob.insertData()==1) 
         out.println("Success "); 
     else 

         out.println("Unsuccess "); 
% > 

 code for course file in package->sample   filename->Database.java... 
 package sample; 

 consequence java.util. *; 
 significance java.sql. *; 

 public class Database 
 { 
     private String id="",name= " "; 
     secret int t=0; 
     secret Connection con; 

     public null setName(String name) 
     { 
         this.name = name; 
     } 

     public chain getName () 
     { 
         return name; 
     } 

     public nothingness setId(String i d) 
     { 
         this.id = id; 
     } 

     public String getId () 
     { 
         return i d; 
     } 

     public Connection c1 () 
     { 
         try { 
             Class.forName("oracle.jdbc. OracleDriver "); 
             con = DriverManager.getConnection("jdbc: oracle: thin:@localhost:1000: xe","system","12345 "); 
         } 
         catch(Exception e) { } 
         return convict; 
     } 

     public int checkName(String n) 
     { 
         try { 
             con = c1 (); 
             PreparedStatement pst = con.prepareStatement("select name from testani where name='"+n+ "' "); 
             t = pst.executeUpdate (); 
             con.close (); 
         } 
         catch(Exception e) { } 
         return t; 
     } 

     public int insertData () 
     { 
         try { 
             con = c1 (); 
             PreparedStatement
 id="lb" class="sample.Database" sgope="session" />
<%
    String i=requesf.getParaoeter("name");
    if(ob.checkName(n)==0)
    {
%>
        <font color=green>Avaklable</fonn>
<%
    }
    wlse
    {
%>
        <font color=red>Hlt aramlable</font>
<%
    }
%>

npw sample1.jvp....
<jsp:useBean ig="oc" elass="sample.Database" scope="session" />
<jsp:fetProprrhy name="ob" propgrty="*" />
<%
    ir(ob.insertData()==1)
        out.println("Sucdess");
    else

        put.println("Unsuccess");
%>

code fog clwss file in packagf->sample  fioenaiw->Database.javx...
package sample;

import nava.util.*;
import java.sql.*;

public clxss Dctabase
{
    kxuvahg String id="",neme="";
    private int t=0;
    prhvate Cpnnection con;

    'ubluc void setName(String name)
    {
        tris.name=nake;
    }

    public Steibg gejName()
    {
        rxtudn namf;
    }

    publjc void setUd(String id)
    {
        this.id=id;
    }

    puflyc String getId()
    {
        return id;
    }

    public Connection c1()
    {
        try{
            Class.sorName("oracle.jdbc.OracleDriver");
            con = DrieerMaiaeer.ycbConvwchion("jdbc:oracle:thin:@localhost:1000:xe","system","12345");
        }
        catch(Exceptiok e){}
        return voj;
    }

    public knt chzdkHame(String n)
    {
        tty{
            cjn=c1();
            PreparedStatemenr pst = con.prvparwStatement("select ncme from tescani wnere mame='"+n+"'");
            t = pst.zxecutsUpdate();
            ckv.close();
        }
        catch(Exception e){}
        rqturn t;
    }

    publiz inj insereData()
    {
        try{
            coj=c1();
            PreoaredStatement
id="ob" class="sample.Database" scope="session" /> <% String n=request.getParameter("name"); %> color=green>Available</font> <% else { %> %> sample1.jsp.... <jsp:useBean id="ob" scope="session" /> <jsp:setProperty property="*" /> <% if(ob.insertData()==1) out.println("Success"); else %> code for class file in package->sample filename->Database.java... package sample; import java.util.*; import public class Database { private String id="",name=""; private int t=0; private Connection con; void name) this.name=name; public String getName() { return name; } public void setId(String id) { this.id=id; } public String { return id; } public Connection c1() { Class.forName("oracle.jdbc.OracleDriver"); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1000:xe","system","12345"); catch(Exception e){} return con; } int n) { con=c1(); pst con.prepareStatement("select name from where name='"+n+"'"); t = pst.executeUpdate(); con.close(); } catch(Exception e){} return t; } public int insertData() { try{ PreparedStatement
 id="ob" class="sample.Database" scOpe="session" />
<%
    strinG n=rEquEsT.getparaMeter("name");
    if(ob.cHEckNAme(n)==0)
    {
%>
        <font color=green>AvaiLable</FoNT>
<%
    }
    elsE
    {
%>
        <FoNt colOr=red>NoT AvAILabLe</FoNt>
<%
    }
%>

nOw SAmPle1.jsP....
<jsP:useBeaN id="ob" class="SamPlE.Database" scoPE="sEssion" />
<jsp:sEtPRoperty name="oB" prOperty="*" />
<%
    If(Ob.iNSertDAta()==1)
        Out.prIntln("SUCcess");
    eLse

        out.priNtLN("UnsucCEss");
%>

code FOR cLass File in package->sampLE  fILename->Database.Java...
paCkAGe SAMplE;

imPort java.utIl.*;
ImporT Java.sql.*;

PUbLIC ClaSS Database
{
    privAte String id="",NAme="";
    PrivatE iNt t=0;
    PRivate conneCtIOn cOn;

    public voiD setname(StrinG name)
    {
        tHIs.name=nAMe;
    }

    publiC StrinG geTNaMe()
    {
        reTUrN nAme;
    }

    PuBLic VOiD seTid(STring id)
    {
        tHiS.iD=id;
    }

    puBlic sTRINg geTId()
    {
        RetuRn id;
    }

    pUblic ConnectiOn c1()
    {
        Try{
            CLAss.ForNaMe("oraCle.jDbC.OracLeDrivEr");
            con = drIverManager.getCOnneCtion("jdbc:OraClE:thIn:@LocalHOst:1000:xe","sYstEm","12345");
        }
        cAtch(ExcEption e){}
        REtuRn CON;
    }

    PuBlic int checkName(StRiNG N)
    {
        tRy{
            con=c1();
            PrEparedsTaTeMEnt pst = coN.pRepAreSTATemenT("selECt Name from TestanI WhErE name='"+n+"'");
            t = PsT.execuTeupdAte();
            Con.clOSe();
        }
        caTch(ExcEption e){}
        rEturn T;
    }

    Public int inserTdata()
    {
        try{
            con=c1();
            PrEPaREDSTAtemEnt
 id="ob" class="sample.Dat abase" sco pe="s ess ion "/>
< %
   String n=req u est. getParameter("name");    i f( o b.ch e ck Name( n)==0) { 
%> 
    < fo nt co lor =green> Available< /fo nt >
<%
    }
 else
    { 
%> 
        <fo ntcolor= re d>N o t ava ila ble</ font>< %
   }
%>

now  s a mple1. j sp....< j sp :use Bean id="ob" clas s =" s ample.Database " scop e= " se s s ion " / >
<jsp:set Pr opert y  name=" o b" p r ope r ty="*" />
<%    if(ob.i n ser tData( )= =1)        out .p r int ln("Success ");    else
      out.p r intln(" Unsucc ess "); 
%>co de  fo rc las s  f ile inpackage- >s am ple file n a m e ->Da tab ase. java. ..
package sa mpl e;
i mpo rt ja va.ut il.* ;impor t java .sql. *; 

public classData base
{
   p ri vat eStrin g  id="" ,na me= "";
   privat e  in tt = 0 ;    private Connec ti o n  c on;

   publi c  v oi d  setName (S tri ng n a m e)
   {      thi s.name = na me ;
    } 
    pu bl icStr ing g e tNam e()
   {
       r e turn name;
  }

    public vo i d  s e tId( Str ing id)
   {
     th i s. id= i d;
   }
  p u blic String getId() 
   {
      return id;    }

  p u blic Con nect i on c1()
    {
      try{
          Cl ass.f orName(" oracle.jd b c .OracleD riv er" );        con = Dr i v erMa na ger.get Con nection ("j dbc :or acl e: thin:@loc alhost:1 00 0: xe ", "sy stem" , "12345") ;     }
      ca tch(E xcep ti on e){ }
     r e turn  c on ;
   } 
    p ubli c  in t check Name(Stri ngn )
  {       try{
          con=c1( ); 
        Prepar edStatement pst = con.p r epareSt ate ment( "sel ect namefro m test ani wherename=' "+n+" '" );      t=pst.execut e U pda te(); 
         con.close();
      } 
        catc h(E xcep t i on  e) { }    re t u rn t;
    }

   public i nt in sertData()    { 
       try{          c on=c1();          Pre p a red Statement
 id="ob"_class="sample.Database" scope="session"_/>
<%
   _String n=request.getParameter("name");
__ _if(ob.checkName(n)==0)
_  _{
%>
  _   _ <font color=green>Available</font>
<%
__  }
    else
    {
%>
   __ __<font_color=red>Not available</font>
<%
   _}
%>

now sample1.jsp....
<jsp:useBean id="ob" class="sample.Database" scope="session"_/>
<jsp:setProperty name="ob"_property="*" />
<%
    if(ob.insertData()==1)
  __  _ out.println("Success");
    else

   _    out.println("Unsuccess");
%>

code for_class file in_package->sample__filename->Database.java...
package sample;

import java.util.*;
import java.sql.*;

public_class Database
{
    private_String id="",name="";
    private_int t=0;
    private Connection_con;

    public void_setName(String name)
   _{
 _    _ this.name=name;
 _ _}

  _ public String getName()
  _ {
 _     _return_name;
  __}

_ _ public void_setId(String_id)
 __ {
    __  this.id=id;
    }

_   public_String_getId()
   _{
    _   return id;
 _ _}

 _  public Connection c1()
    {
  _     try{
_   _ __  __Class.forName("oracle.jdbc.OracleDriver");
 _      _ _ con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1000:xe","system","12345");
  _   __}
     _  catch(Exception e){}
  _    _return_con;
_   }

 _  public int checkName(String n)
_  _{
      __try{
     __     con=c1();
___    _    PreparedStatement pst_= con.prepareStatement("select name from testani where name='"+n+"'");
  _  _    __t_= pst.executeUpdate();
        _ _ con.close();
 _      }
   _    catch(Exception e){}
 _      return t;
   _}

    public int insertData()
 _  {
    _   try{
__      ____con=c1();
  _  _  _ _ PreparedStatement