• Save
Java Training Ahmedabad , how to Insert Data in Servlet
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Java Training Ahmedabad , how to Insert Data in Servlet

on

  • 345 views

NicheTech is the best software company in Ahmedabad . ...

NicheTech is the best software company in Ahmedabad .

We are offering best software service in Ahmedabad.

We are also providing java training Ahmedabad .
NicheTech is helping in best java course Ahmedabad .
NicheTech helps you for java classes Ahmedabad .

WWW.LiveProjecttraining.in

Statistics

Views

Total Views
345
Views on SlideShare
344
Embed Views
1

Actions

Likes
0
Downloads
2
Comments
0

1 Embed 1

http://www.gtuprojecttraining.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Java Training Ahmedabad , how to Insert Data in Servlet Presentation Transcript

  • 1. By: NicheTech http://www.nichetechinstitute.com/ ©NicheTech Computer Solutions Pvt ltd Demo Example for Insert records in Servlet
  • 2. Login.jsp <html> <head> </head> <title>Login</title> <body> <form name="Login_form“ action=“Login" method="post"> User Name <input type="text" name="UserName" /> <br /> Password <input type="password" name=“pwd" /><br /> <input type="submit" name="sSubmit" value="Submit" /> </form> </body> </html>
  • 3. connectivityClaas.java //Required import packages import java.io.*; import java.util.*; import javax.sql.*; import javax.servlet.*; import javax.servlet. Http.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;
  • 4. //class Nmae Declration  public class connectivityClaas extends HttpServlet  { // connecting to database object Connection cn = null; PreparedStatement pst try { Class.forName("com.mysql.jdbc.Driver"); con =DriverManager.getConnection (“localhost/Testexample", "root","root"); String username = req.getParameter(“UserName"); String fname = req.getParameter(“pwd"); stmt = con.createStatement(); String sql ="insert into login values (?,?)"; pst = connection.prepareStatement(sql); int numRowsChanged = pst.executeUpdate();
  • 5. if(numRowsChanged==true) { out.println(“Successful Inserted”); }else { out.println(“Faild to Inserted”); } } catch (Exception){} }
  • 6. Thanks  NicheTech Com Sol Pvt Ltd  Our Sites 1) http://www.nichetechsolutions.com/ (Development) 2) http://www.nichetechinstitute.com/ (NicheTech Gurukul) 3) http://www.liveprojecttraining.in/ ( Live Project Training Details) 4) https://www.facebook.com/nichetechinstituteIndi a ( For Daily Updates)