Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa HTML HTML code to servlet to database using jdbc

Have Programming Question? Ask it here!
 
 
 


anjali pathuri
HTML code to servlet to database using jdbc
1 Answer(s)      3 years and 8 months ago
Posted in : HTML


pls send me the code related to the title


Advertisement
View Answers

December 6, 2010 at 12:49 PM


Hi Friend,

Try the following code:

1)form.html:

<html>
<form method="post" action="http://localhost:8080/examples/Data">
<table>
<tr><td>Message:</td><td><input type="text" name="msg"></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>

2)Data.java:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;

public class Data extends HttpServlet { 
    public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException {
        String msg=req.getParameter("msg");
        res.setContentType("text/html");
        PrintWriter out = res.getWriter();
        System.out.println(msg);
        try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:student","","");
    Statement stmt=con.createStatement();
    int i=stmt.executeUpdate("insert into data(message) values('"+msg+"')");
    out.println("Message successfully added!");
        con.close();
        } 
        catch(Exception e){
        System.out.println(e);
        }
        }
        }

Thanks



Related Tutorials/Questions & Answers:
HTML code to servlet to database using jdbc
HTML code to servlet to database using jdbc  pls send me the code related to the title   Hi Friend, Try the following code: 1)form.html...=req.getParameter("msg"); res.setContentType("text/html"); PrintWriter
database entry using jdbc
database entry using jdbc  Give me a program to enter records in table using jdbc in java.   Hi Friend, Please visit the following link: Insert data into database Thanks
Advertisements
Sending form data from HTML page to SQLserver 2005 database by calling servlet code
from html page to database by calling servlet code from html page .   Hello Friend, Try the following code: 1)callServlet.html: <html> <...Sending form data from HTML page to SQLserver 2005 database by calling servlet
Html/JavaScript code - JSP-Servlet
Html/JavaScript code  I have 2 JSPs JSP1 and JSP2. 1.in JSP1 i have a table being displayed using the tag and cells in it contain links(huge..., ------------------------------------------ If, you have any problem then , please send me detail with code. Thanks. 
html dropdownlist code - JSP-Servlet
html dropdownlist code  hi how to get textfield in html when i select the option others in the dropdown list, pls provide the code?   Hi Friend, Try the following code: function show(){ var op
inserting multiple file formats into database using html
inserting multiple file formats into database using html   hi the code was working fine,i want to choose the file and then upload to database,by using html.whether it is possible to upload larger file size,please explain
JDBC Connection code to connect servlet with oracle.
JDBC Connection code to connect servlet with oracle.  JDBC Connection code to connect servlet with oracle
JSP,JDBC and HTML(Very Urgent) - JSP-Servlet
details from database using JDBC and JSP. The home page i.e HTML Page must contain... the code: I am not using any html. I used only jsp & jdbc. HOme Page...JSP,JDBC and HTML(Very Urgent)  Respected Sir/Madam, Thanks
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
how to insert data in database using html+jsp
how to insert data in database using html+jsp  anyone know what is wrong with my code? print("<% /* Create string... and database name. Here machine name id localhost and database name
regarding ms acces database and servlet - JDBC
name (e.g emp) 6. Click "Ok" and then try the following Servlet code where...regarding ms acces database and servlet  hello there, i am trying... database, i could run java main programs(i e not servlets public static void main
View source code of a html page using java ..
View source code of a html page using java ..  I could find the html source code of a web page using the following program, http://download.oracle.com/javase/1.4.2/docs/api/java/net/URLConnection.html i could get the html code
database connectivity using jsp code
database connectivity using jsp code  i have two tables employee and adduser insert into adduser(Emp_Id,Ename,Designation,Password,ReTypePassword...),'bbbb','bbbb'); so this syntax is possible to use in jsp code based
How to delete the row from the Database by using servlet
: Delete row from database using servlet   In that link solution... details (HTML Page, Database table, Servlet Program) see this link link text...How to delete the row from the Database by using servlet  Dear Sir
download code using servlet - Servlet Interview Questions
download code using servlet  How to download a file from web to our system using Servlet
to run html code in web browser - JSP-Servlet
to run html code in web browser  how to run jsp file which calls html file on web browser??  Hi Friend, Try the following code: 1)form.jsp: Enter Name: 2)welcome.html: Add Profile Edit
unable to retrive the data from mysql using servlet using jdbc driver
unable to retrive the data from mysql using servlet using jdbc driver  Hi, i have a servlet program..to verify the login and redirect to correct html page on verification. public class LoginServlet extends HttpServlet implements
Insert  Image into Database Using Servlet
Insert  Image into Database Using Servlet   ... of inserting image into database table using Servlet. This type of program is useful... to retrieve the image from database using Servlet. After retrieving the image from
Insert Image into Database Using Servlet
Insert  Image into Database Using Servlet   ... image into database table using Servlet. This type of program is useful in social... the image from database using Servlet. After retrieving the image from database
edit database using jsp and servlet
edit database using jsp and servlet  I am creating a website using jsp and servlets that is used to view houses from a database. I want to be able... information from the database in the textboxes. Please help me to display
database backup and restore using java - JDBC
database backup and restore using java  Hi... I have MS Access 2000 database.I want to backup and restore the db using jdbc.What's the procedure for that. Thanks in advance
code for jsp to db connection using jdbc
code for jsp to db connection using jdbc  please send me the code   Hi Friend, Try the following code: 1)form.html: <html> <...("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc
HTML - JDBC
to retrieve tha data into second combo box from Database when ever select option from combobox. please send me code of html   Hi Friend, To do...HTML  I created on html page with two comboboxes. when ever i select
jsp or sevlet and html form to send picture to database - JSP-Servlet
that contains his picture to database. What I need are html page for the form that will browse for the picture, jsp or servlet that the info from html will go...jsp or sevlet and html form to send picture to database  Hello guys
Connecting to the Database Using JDBC and Pure Java driver
engine our application communicate with database using JDBC...Connecting to the Database JDBC Driver In our search engine we are using MySQL database server and MM.MySQL Driver
give me source code of webpage creation using html
give me source code of webpage creation using html  how to create a webpage using html
How to populate an HTML table using jstl code - Spring
How to populate an HTML table using jstl code  Hi I want to populate an HTML table using jstl code.I am using Hasp map.For 1 column its okay it works fine.But if I am suppose to populate 2 or 3 columns from the database than
jdbc code - JDBC
) Pass the resultSet using Servlet Context to the next page. Rajanikant ...jdbc code  Dear Sir, i have created one jsp with two fields 1.username 2.password and i have connected to database
Jsp Code to store date in database - JSP-Servlet
Jsp Code to store date in database   Hi, Can u give me jsp code to store current date in to database. Thanks Prakash
how to display a table from database using servlet
how to display a table from database using servlet  how to display... the following link: http://roseindia.net/jsp/servlet-jsp-data-list.shtml Thanks...://roseindia.net/jsp/servlet-jsp-data-list.shtml Thanks
html - JDBC
html  How to insert a new column into HTML (or jsp) table dynamically? i have to print a table of html depending on number of subjects (where subjects are retrieved from Oracle)? I retrieved values from Oracle through
coding for horizontal menubar using using html or javascript - JSP-Servlet
coding for horizontal menubar using using html or javascript  hii friends, i wanted to implement horizontal menubar in my project tht wil open the links to diffrnt pages kindly help
mini project using html,javascript and ms access with source code
mini project using html,javascript and ms access with source code  I want a mini project which uses html and java script and backend as ms access with source code. plz send its important and urgent
place data in text fields from database using jdbc
place data in text fields from database using jdbc  i want get the data from database and place the records in the respective textfields using jdbc and swing like eno,ename,loc from emp table
how to load values of html form into an excel table using java servlet?
how to load values of html form into an excel table using java servlet?   i have written a java servlet program, which has a html form to be filled. after filling the form the servlet generates a receipt and the values should
Database connectivity with jsp code - JSP-Servlet
Database connectivity with jsp code  I have written a program in java having connectivity with online_exam. Its working properly. Connection has been established and the code in java is showing the output. But the problem
storing date from html form to oracle 10g using servlet
storing date from html form to oracle 10g using servlet  i have... this date month year from html form into oracle 10g database where i have... necessary coding..not mentioned here my full html form and servlet coding
Populate dropdown menu from database using jsp and servlet
Populate dropdown menu from database using jsp and servlet  please i need code to populate dropdown menu from mysql database using jsp and servlet. thanks
code for password strength using jsp-servlet
code for password strength using jsp-servlet  hi.............. plz help me to give code for password strength using jsp-servlet for implementation in my project as soon as possible because i want to show this functionality in my
Image upload in mysql database using jsp servlet
Image upload in mysql database using jsp servlet  Hello, I need code to insert image in mysql database, I have seen the code which is already in your portal but it is not inserting image into database it save in the folder
html report generation in emma code coverage using ANT acript
html report generation in emma code coverage using ANT acript  Hi Deepak, I am using emma code covarage tool and to generate coverage report by using Ant script i am getting following exception [report
storing date from html form to oracle 10g using servlet
storing date from html form to oracle 10g using servlet  i have... this date month year from html form into oracle 10g database where i have... necessary coding..not mentioned here my full html form and servlet coding
Alter Database Table Using JDBC Batch Process
Alter Database Table Using JDBC Batch Process: In this example, we are discuss about alter database table using JDBC Batch process. First of all, we... for alter database table. 1. Create Statement object using createStatement
Expport data into CSV File using JDBC in Servlet
into CSV File using JDBC in Servlet   ... into CSV file using JDBC in Servlet. We have created  file "JdbcCsvFile.java" to export data from database in to CSV file. Brief
HTML code
HTML code  How do I keep people from stealing my source code and/or images
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need help creating a mysql database for this code. code is import java.awt...."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need help creating a mysql database for this code. code is import java.awt...."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/register
fetch and insert multiple rows into mysql database using jsp servlet
a problem to insert multiple rows into database using a single insert query here is the code of both jsp and servlet <%@page contentType="text/html...fetch and insert multiple rows into mysql database using jsp servlet  
Upload Excel into Database Table Using SERVLET - JSP-Servlet
Upload Excel into Database Table Using SERVLET  Hi i hava sitution that upload .xls file into database table which has same coloumn names... in database table are NAME,ID,SAL. please help me to upload that excel using
Advertisements
 

 

 

DMCA.com