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



Home Answers Viewqa JSP-Servlet create a button
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


laharika
create a button
1 Answer(s)      2 years and 9 months ago
Posted in : JSP-Servlet


i have created button inhtml but my jsp is not working,so can u guide me


Advertisement
View Answers

February 10, 2012 at 11:51 AM


1)form.html:

<html>
<form method="post" action="http://localhost:8080/examples/jsp/insert.jsp">
<table>
<tr><td>First Name:</td><td><input type="text" name="fname"></td></tr>
<tr><td>Last Name:</td><td><input type="text" name="lname"></td></tr>
<tr><td>Email:</td><td><input type="text" name="email"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
<tr><td>Confirm Password:</td><td><input type="password" name="cpass"></td></tr>
<tr><td>Date Of Birth</td><td><input type="text" name="dob"></td></tr>
<tr><td>Age:</td><td><input type="text" name="age"></td></tr>
<tr><td>Gender</td><td><input type="text" name="gender"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"></td></tr>
<tr><td>Country</td><td><input type="text" name="country"></td></tr>
<tr><td>State:</td><td><input type="text" name="state"></td></tr>
<tr><td>City</td><td><input type="text" name="city"></td></tr>
<tr><td>Telephone No:</td><td><input type="text" name="tno"></td></tr>
<tr><td>Mobile:</td><td><input type="text" name="mobile"></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>

2)insert.jsp:

<%@page import="java.sql.*,java.util.*"%>
<%
String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
String email=request.getParameter("email");
String pass=request.getParameter("pass");
String cpass=request.getParameter("cpass");
String dob=request.getParameter("dob");
int age=Integer.parseInt(request.getParameter("age"));
String gender=request.getParameter("gender");
String address=request.getParameter("address");
String country=request.getParameter("country");
String state=request.getParameter("state");
String city=request.getParameter("city");
int telephone=Integer.parseInt(request.getParameter("tno"));
int mobile=Integer.parseInt(request.getParameter("mobile"));
        try{
         Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/roseindia", "root", "root");
           Statement st=con.createStatement();
           int i=st.executeUpdate("insert into student(firstname,lastname,email,pass,confirm_pass,dob,age,gender,address,country,state,city,telephone,mobile) values('"+fname+"','"+lname+"','"+email+"','"+pass+"','"+cpass+"','"+dob+"',"+age+",'"+gender+"','"+address+"','"+country+"','"+state+"','"+city+"',"+telephone+","+mobile+")");
        out.println("Data is successfully inserted!");
        }
        catch(Exception e){
        System.out.print(e);
        e.printStackTrace();
        }
        %>


Related Tutorials/Questions & Answers:
create a button
create a button  i have created button inhtml but my jsp is not working,so can u guide me
Create Button in CSS
Create Button in CSS  Can anyone help me to create a button in CSS HTML
Advertisements
create a button in html
create a button in html  How do I create a button which acts like a link
How to Create Button With TableView in iphone
How to Create Button With TableView in iphone  My requirement is i am creating one button. when i press the button TableView will display... on the button can u please send me the code i want to create converter app. thanks
How create an overlay button on different containing div
How create an overlay button on different containing div  How to create an overlay button on different containing div
Create Round Button in Java swing
Create Round Button in Java swing In this tutorial, we are going to create a button of round shape. Java2D APIs and Java Swing make it easy to implement... static void main(String[] args) { JButton button = new CreateRoundButton
How would you create a button with rounded edges?
How would you create a button with rounded edges?   How would you create a button with rounded edges?   Hi, Here is the answer, We can create rounded edge button in two way's, The first thing is to know
Create a input button inside js function
Create a input button inside js function  I call my js function from HTML code from another file. Now I would like to create a input button on page.... Now I would like to create a input button on page using createElement() in my
How to Create Button on Frame
How to Create Button on Frame       In this section, you will learn how to create Button on ... will show a simple command button labeled with the text "Submit" when
List the names of classes used to create button and text box in Java.
List the names of classes used to create button and text box in Java.  List the names of classes used to create button and text box in Java
Button
Button  How to use image for button in JSF
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can we retriving dat from database, capturing data, moving to next page.. etc
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can be retriving dat from database, capturing data, moving to next page.. etc
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse  please help me i have to submit this soon
create text box by clicking button and submittong text in text box using submit
create text box by clicking button and submittong text in text box using submit  Hi, I created a button when i click on button new textbox... will click submit button the text should be submitted(it shows the value in text
Create UIButton Programmatically
and add a button on UIView dynamically. To create a button programmatically just... req. like you can create a simple RoundedRect button or a custom button if need..., we have successfully create a button but to add this button on view we need
Radio Button in Java
by the user. The AWT  Widget used to create a radio button is Checkbox. The Checkbox class is used by the AWT to create both Radio Button and Checkbox. There is no Radio Button class.awt to create a RadioButton.In order to create
Create a JRadioButton Component in Java
Create a JRadioButton Component in Java       In this section, you will learn how to create a radio button in java swing. Radio Button is like check box. Differences between check
how can create pop() method in this program ,Or how can delete image in it when i press pop button in runtime ??? please help me ...
how can create pop() method in this program ,Or how can delete image in it when i press pop button in runtime ??? please help me ...   ...(new BorderLayout()); //Load the pet images and create an array of indexes
Java Swing Create LinkButton
are going to create a Link Button that will allow you to move to another page...Java Swing Create LinkButton You all are aware of JButtons, JRadioButtons...()); JButton button = new JButton(); button.setText("www.roseindia.net
create
create  how to create an excel file using java
iPhone Button Click Sound
don't know how to create the button then please check the previous button... iPhone Button Click Sound In this series of iPhone button tutorial, we are going to create a small iphone application that is going to play a sound
Create Radio Buttons in SWT
;    This section illustrates you how to create radio button. In SWT, the style RADIO defined in the Button class allows to create radio button. We have create an array object of Button class. The class Label displays
Dojo Radio Button
Dojo Radio Button          In this section, you will learn how to create radio buttons in dojo. For creating radio button you need "dijit.form.CheckBox". The radio
HTML Button Size
HTML Button Size       Button in HTML is used to submit HTML page. Understand with Example The Tutorial illustrate an example from HTML Button size. In this Tutorial we
Creating Flex ActionScript Custom Component extending Button
; } Creating Flex ActionScript Custom Component extending Button   ActionScript can be used to create custom components. In the example below,  a custom button component is created by extending Button class.  
iPhone Button Image
iPhone Button Image In this tutorial will learn how to Create iPhone Button... First will create button through which will set image on window when button is clicked. so to create iphone buttons on window will write
facebook like button code
facebook like button code  How to create a facebook like button? can anyone share the code..?? Thanks in advance
Radio Button in J2ME
to demonstrate, how to create the radio button in J2ME using MIDlet. The radio button is use to choose only one option at a time. To create the radio button we... Radio Button in J2ME      
wnidows button
wnidows button   How to handle windows back and forward button in struts applications, without using java script
Swing Button Example
Swing Button Example  Hi, How to create an example of Swing button in Java? Thanks   Hi, Check the example at How to Create Button on Frame?. Thanks
Advertisements
 

 

 

DMCA.com