webpage

webpage

java, servlet and JSPs to create a web page with a text box and a button named submit. after submitting i shpuld get a msg successfully added.

View Answers

November 29, 2010 at 4:41 PM

Hi Friend,

Try the following code:

1)form.jsp:

<html>
<form name="form" method="post" action="../Data">
Enter Message: <input type="text" name="msg">
<input type="submit" value="submit">
</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");
        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:
webpage
webpage  design a webpage student database using forms and frameset
webpage capture
webpage capture   webpage capture source code using jsps and servlets
Advertisements
copy something from a webpage to my webpage
copy something from a webpage to my webpage  How can I copy something from a webpage to my webpage
webpage
make a webpage
make a webpage   I will provide you some basic requirements that you will be implementing over a small web page... Requirements: A web page having... webpage in a different way Try to use features of HTML5, CSS3 and JavaScript
ModuleNotFoundError: No module named 'webpage'
ModuleNotFoundError: No module named 'webpage'  Hi, My Python... 'webpage' How to remove the ModuleNotFoundError: No module named 'webpage... to install padas library. You can install webpage python with following command
ModuleNotFoundError: No module named 'webpage'
ModuleNotFoundError: No module named 'webpage'  Hi, My Python... 'webpage' How to remove the ModuleNotFoundError: No module named 'webpage... to install padas library. You can install webpage python with following command
Showing div at the center of the webpage
Showing div at the center of the webpage  Showing div at the center of the webpage
Last modified time of a webpage
Last modified time of a webpage  how can we get the last modified time of a webpage using java
ModuleNotFoundError: No module named 'webpage-reader'
ModuleNotFoundError: No module named 'webpage-reader'  Hi, My... named 'webpage-reader' How to remove the ModuleNotFoundError: No module named 'webpage-reader' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'webpage-reader'
ModuleNotFoundError: No module named 'webpage-reader'  Hi, My... named 'webpage-reader' How to remove the ModuleNotFoundError: No module named 'webpage-reader' error? Thanks   Hi, In your python
How to print a webpage without url and date in jsp ?
How to print a webpage without url and date in jsp ?  How to print a webpage without url and date in jsp
displaying a physical webpage with frames in iframe
displaying a physical webpage with frames in iframe  i have iframe in my webpage, i have done the coding part for browsing the folders and viewing... sources.i tried to display a sample webpage without frames and it was a success
JSP - Problem of displaying result at webpage
JSP - Problem of displaying result at webpage  Can anyone please help to solve my problem below. My webpage has problem in displaying result position. The result should be display below my title. How do i solve it? Thank you so
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
Login Box appears when a button on the webpage is clicked
Login Box appears when a button on the webpage is clicked  How to create a Login Box on a web page that appears only when a button that is already present on the page is clicked
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
display resume content in webpage - JSP-Servlet
display resume content in webpage  Hi everbody, I have to display resume(.pdf, .doc,.rtf..txt)file content into a webpage(jsp or html). please i want help like are there any APIs available or any solution?? thank in advance
Page is not getting loaded when I refresh the webpage???
Page is not getting loaded when I refresh the webpage???  **I am loading an image section(image,demo link,Zoom) in a webpage by using javascript function in JSP. It will get all details of image section from database. *I am
Login Box appears at the background of my webpage?
Login Box appears at the background of my webpage?   As per the answer regarding my earlier query, when I post the code in my HTML page, the Login Box appears at the background of my HTMl page...........I tried CSS to change its
displaying a calendar of only current month in jsp on webpage using javascript
displaying a calendar of only current month in jsp on webpage using javascript  how can we display a calendar of only current month in jsp on webpage using javascript
hi RoseIndia why there is not Fackbook Like button on your webpage?
hi RoseIndia why there is not Fackbook Like button on your webpage?   hi RoseIndia why there is no Fackbook Like button on your webpage? That's the only prob in your problem. Others are excellent
How to export the table content from an webpage to excel using java?
How to export the table content from an webpage to excel using java?  How to export the table content from an webpage to excel using java? The table contents are generated dynamically in that java page
How to export the table content from an webpage to excel using java?
How to export the table content from an webpage to excel using java?  How to export the table content from an webpage to excel using java? The table contents are generated dynamically in that java page
Open InternetExplorer Webpage with Java - Java Beginners
Open InternetExplorer Webpage with Java  Hello Sir I want to Open my webpage from swing application when I Click On "VISIT US" Boutton then website will be display How I can Create it on Button Click.  Hi Friend
how to display the data from excel to webpage
how to display the data from excel to webpage  Hi, I need help on following I have a webpage contains a text box and a button(get), i give a value in text box such as serial no. like 4024 and by click on get button it should
how to send the content of jtextarea from netbeans IDE to webpage's textarea in java
how to send the content of jtextarea from netbeans IDE to webpage's textarea in java   Hi, i m interested to send the content of my jtextarea which i have developed in netbeans IDE to the webpage's textarea. how can i do
Parent child windows relationships when webpage is accesssed through a hyperlink.
Parent child windows relationships when webpage is accesssed through a hyperlink.  A particular session timeout functionality works when a webpage is loaded. The webpage has parent/child windows. This timeout functionality works
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]
Accessing MS ACCESS databse using a HTML webpage [created using Javascript... pressing the button - 'Submit'. the webpage includes fields like Name, Age, Sex... be displayed in a webpage after click the button - 'show details'. Could you pls help me
Volume setting for webpage flash - Design concepts & design patterns
Volume setting for webpage flash   Hello: I'm glad I found your website. Thank you for the opportunity to ask questions. For months I'v been searching with no success for a way to enter a volume setting for the flash file
how to convert php webpage to jpg file/take screenshot from client side
how to convert php webpage to jpg file/take screenshot from client side  how to convert php webpage to jpg file/take screenshot from client side
How to add google page in my webpage using jquery ajax.
How to add google page in my webpage using jquery ajax.  Hi, I created a page index.html on desktop . this page content following code. <html> </head> <script type="text/javascript" src="http
webpage which client can enter his or her name
webpage which client can enter his or her name   1.if client has entered name he must click on submit button,new webpage should appear which welcome him or her with either one of following messages: "good morning,[name]!","good
webpage which client can enter his or her name
webpage which client can enter his or her name   1.if client has entered name he must click on submit button,new webpage should appear which welcome him or her with either one of following messages: "good morning,[name]!","good
How to find the size of a dynamic webpage using java... eg : Youtube........
How to find the size of a dynamic webpage using java... eg : Youtube........  package newpack; import java.io.BufferedInputStream; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL
create webpage with table sql database using netbeans 6.8 with struts complete tutorial.(include username and password)
create webpage with table sql database using netbeans 6.8 with struts complete... webpage using java&j2ee.that webpage contain a home,carriers,contactus,about... with that project.i have an idea do create webpage using netbeans 6.8 version
create webpage with table sql database using netbeans 6.8 with struts complete tutorial.(include username and password) 0 Answer(s)
create webpage with table sql database using netbeans 6.8 with struts complete tutorial.(include username and password) 0 Answer(s)  create webpage with table sql database using netbeans 6.8 with struts complete tutorial.(include
Will i be able to get the content of a webpage in a word document (Note:i don t have access to the source code)through java code?
Will i be able to get the content of a webpage in a word document (Note:i don t have access to the source code)through java code?  public class... document to the webpage(for which i don t have access to source code
title and keywords don't refresh in webpage - JSP-Servlet
Save Any Eclipse Editor as HTML
the java into a webpage). So I figured, Eclipse has the style information needed
Screen shot
Screen shot  webpage screenshot source code
beginner
beginner  provide a simple html program to develop a webpage
setting web page size
setting web page size  How to set the webpage size in Java
Internet Programming
Internet Programming  design a webpage student database using forms and frameset
Internet Programming
Internet Programming  design a webpage student database using forms and frameset
HTML Upload
HTML Upload  Hi, I want to upload a word / excel document using the html code (web interface)need to get displayed on another webpage. Please let me the coding to display on another webpage using
Top 5 Ad Networks which can be used with Google Adsense
cache php code
cache php code  Basically, i'm looking for a code to cache the content of webpage in server side
Jvaa
Jvaa  How can we add a advertisement in java(JSP,Servlet) upon a webpage in small window with a closing option

Ads