SERVLET AND JSP

SERVLET AND JSP

If i want tio create a login form using SUBMIT,ADD,DELETE,and MoDIFY button,when I click on the ADD button then on the next page Employee Id which is primary key will generate automatically from the oracle database,and also on the same page there is drop down list of department,when i select the department then value of that department will be inserted in the database,kindly give me reply as soon as possible............

View Answers

April 3, 2012 at 3:21 PM

1)register.jsp

<html>
<form method="post" action="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>Language:</td><td><select name="lang">
<option value="C/C++">C/C++</option>
<option value="C#">C#</option>
<option value="Java">Java</option>
<option value="Perl">Perl</option>
<option value="Python">Python</option>
</select></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"));
String lang=request.getParameter("lang");

        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,language) values('"+fname+"','"+lname+"','"+email+"','"+pass+"','"+cpass+"','"+dob+"',"+age+",'"+gender+"','"+address+"','"+country+"','"+state+"','"+city+"',"+telephone+","+mobile+",'"+lang+"')");
        out.println("Data is successfully inserted!");
        }
        catch(Exception e){
        System.out.print(e);
        e.printStackTrace();
        }
        %>









Related Tutorials/Questions & Answers:
JSP-Servlet - JSP-Servlet
JSP-Servlet   how to pass the value or parameter from jsp page to servlet and view the passed value
JSP-Servlet - JSP-Servlet
JSP-Servlet   how to pass the value or parameter from jsp page to servlet and view the passed value
Advertisements
JSP-Servlet - JSP-Servlet
JSP-Servlet   how to pass the value or parameter from jsp page to servlet and view the passed value
jsp/servlet - JSP-Servlet
jsp/servlet  How to create and save the excel file on given location using jsp/servlet?  hi Geetanjali, Read for more information, http://www.roseindia.net/jsp/poi/excelPOI.shtml Thanks
JSP-Servlet - JSP-Servlet
JSP-Servlet   how to pass the value or parameter from jsp page to servlet and view the passed value.   Hi Friend, Please visit the following links: http://www.roseindia.net/tutorial/servlet/passParameters.html
jsp and servlet
jsp and servlet  what is the difference between jsp and servlet ? what is the advantages and disadvantages of jsp and servlet
servlet and jsp
servlet and jsp  how to connect an jsp and an servlet without connecting to database
JSP - JSP-Servlet
JSP & Servlet Example Code  Need example of JSP & Servlet
servlet and jsp - JSP-Servlet
servlet and jsp  can any one give me jsp-servlet related project-its urgent- 1-chat application 2-bug tracking system 3-online shopping 4-online...://www.roseindia.net/jsp/bank.shtml Thanks
Servlet - JSP-Servlet
Servlet and Java Code  Example and source code in Servlet and JSP
servlet/jsp - JSP-Servlet
servlet/jsp  hi, get me the source code to upload all file formats in servlet/jsp plaese help me as soon as possible its urgent!!! by saravanan.k  Hi friend, Code to help in solving the problem
Servlet - JSP - JSP-Servlet
Servlet - JSP  i used arraylist in servlet as shown ArrayList total = new ArrayList (); ... total.add(k[i]); session.setAttribute("efg",total); when I code this like in my jsp <%ArrayList<Integer> data= new
servlet and jsp - JSP-Servlet
servlet and jsp  Hello folks, I am very new JDBC. I am doing a project on java messaging service on the part of the project we are using JDBC. In my...   write in the jsp form action="path of servlet" and wirite
servlet and jsp - JSP-Servlet
servlet and jsp  Hi friend, please show one sample program, how to connect jsp and servlet using backend a ms-access.  Hi friend,<%@ page language="java" import="java.sql.*,java.util.*,java.text.*"
jsp/servlet - JSP-Servlet
jsp/servlet  Hello ! How can we call a servlet on a link on html page like a href="servletname"> Call Servlet Is it possible?   Hi friend, I am sending simple application using servlet. This is form
java (servlet) - JSP-Servlet
java (servlet)  how can i disable back button in brower while using servlet or JSP
Jsp-Servlet
Jsp-Servlet  how can i display the values in jsp pages as list from servlet ? can you help me out plz ? thanks
jsp servlet
jsp servlet  i dont know how to write a code to Create a JSP with one text field to enter the URL and a submit button.On clicking the submit button, send the request to a servlet .Once the servlet receives the request, it need
jsp servlet
jsp servlet  i dont know how to write a code to Create a JSP with one text field to enter the URL and a submit button.On clicking the submit button, send the request to a servlet .Once the servlet receives the request, it need
JSP - JSP-Servlet
JSP  if the jsp is converted into servlet which type of code genreted and it will exend which type of servlet?i want answer plzzzz replyyyyyyyyyy
JSP-Servlet
JSP-Servlet  Hi have created a JSP page and I need to print it when the user clicks on the print button. I have put a print button on the JSP page. Can somebody plz help me out with the Servlet page coding
JSP - JSP-Servlet
JSP  What is the meaning of extending JSP?  Hi friend, A jsp can be made to extend our own servlet instead of container generated servlet by using. <%@ page extend="package.className"> Thanks
About jsp and Servlet - JSP-Servlet
About jsp and Servlet  Servlets are directly using java technologies. It is used in HTTP,FTP..etc, But Jsp only used in HTTP. Servlets are running fastly... Then why we moved from Servlet to JSP.. Pl Tell me the reasons
Jsp ,Servlet Problem - JSP-Servlet
Jsp ,Servlet Problem  hi, m new to jsp n Servlet. i really find ur... with oracle. it worked wonders. now i m starting jsp n servlet learning.. pls... to execute a servlet code on tomcat server... Thanking u... Santosh  
JSP with java/servlet - JSP-Servlet
(java bean or servlet) to fecth the database. Jsp would get the data from.../servlet-jsp-data-list.shtml Hope that it will be helpful for you. Thanks...JSP with java/servlet  Thanks Deepak for your answere to my previous
jsp and servlet
the data and delete the data,using jsp and servlet...jsp and servlet  I want to create a login form,which have many fields,and have a connectivity with thwe oracle database,and login form will have
Servlet Error - JSP-Servlet
Servlet Error  Dear All, Which are the jar files needed in Web-inf/lib folder if database is mysql. servlet-api.jar jsp-api.jar mysql-connector...   Hi prakash servlet-api.jar jsp-api.jar mysql-connector
servlet - JSP-Servlet
be the xml code which will describe a servlet and mapps an instance of it with specific url..???  Hi friend, Servlet and JSP Examples. Servlet and JSP Examples
jsp and servlet
jsp and servlet  hello friends just want to create a jsp page... login from login page and if we submit it shud be validated in a servlet using... links: http://www.roseindia.net/jsp/loginbean.shtml http://www.roseindia.net
jsp servlet
code to Create a JSP with one text field to enter the URL and a submit button  i dont know how to write a code to Create a JSP with one text field... the request to a servlet .Once the servlet receives the request, it need to create
jsp servlet
how to write a code to Create a JSP with one text field to enter the URL  i dont know how to write a code to Create a JSP with one text field... to a servlet .Once the servlet receives the request, it need to create a thread
JAVA JSP and Servlet - JSP-Servlet
JAVA JSP and Servlet  for sending mail through lan without intenet and also chatting facility for online users using Java JSP & SERVLET code.  Hi Friend, Please visit the following links: http://www.roseindia.net
How to call servlet in JSP?
How to call servlet in JSP?  How to call servlet in JSP
servlet and jsp
servlet and jsp  how can i get a form question from a database... with servlets and jspīs   Have a look at the following links: http://www.roseindia.net/jsp/paging.shtml http://www.roseindia.net/jsp/navigation
jsp code - JSP-Servlet
jsp code  Can anyone help me in writing jsp/servlet code to retrieve files and display in the browser from a given directory.  Hi Friend, Try the following code: Thanks
JSP - JSP-Servlet
JSP  HI! Every body............. Please send me any simple code for chatting using JSP and servlet... Advance wishes... Happy Pongal
Servlet-JSP population - JSP-Servlet
Servlet-JSP population  Hi, I got my code worked. now I have another task. My jsp page on submit gets redirected to another servlet update cart... with textfields also. how the loop in the servlet should go to check all the boxes
Servlet-JSP Mapping - JSP-Servlet
Servlet-JSP Mapping  Dear Sir, My Query were: How I use the issueData() in Jsp which define in Servlet_Two.java. If any mistake in my code please...\.wlnotdelete\extract\myserver_ProjDemo_ProjDemo\jsp_servlet\__issue.java' failed
Servlet-JSP Mapping - JSP-Servlet
Servlet-JSP Mapping  Dear Sir, My Query were: How I use the issueData() in Jsp which define in Servlet_Two.java. If any mistake in my code please...\.wlnotdelete\extract\myserver_ProjDemo_ProjDemo\jsp_servlet\__issue.java' failed
JSP and Servlet sort - JSP-Servlet
JSP and Servlet sort  Hi I have 3 records in my database. I want to sort them according to their respective headings. Here's the code I have for displaying them in the jsp: Universal Books Home Page
jsp page - JSP-Servlet
jsp page  what are elemets and template data in jsp page??  Hi Friend, Template Data is a parameterized content that allows the JSP document to generate a response stream of characters. JSP Elements provides
servlet - JSP-Servlet
servlet  please post me some attractive learn simple steps tutoriols jsp&servlet with source code or example with netbeans. post all servlet and jsp simple example chapter by chapter who will build my knowldge very fastly
calling servlet from jsp
calling servlet from jsp  how to call a servlet from jsp
JSP - JSP-Servlet
-- Java JSP Servlet JavaScript... on a jsp , once the user selects one of them and clicks a button (say ok) then i... new to JSP's , thank you all for ur time and support  Hi friend, I am
servlet - JSP-Servlet
Inserting values in servlet and jsp  How to Insert the values into database table using Servlet and JSP?  Insert the values into database table using Servlet and JSP.Code ExampleDataInsertionExam.javaimport java.io.
Jsp pagination - JSP-Servlet
Jsp pagination  Iam doing a online exam application for this i need... has to go to the specified servlet and it has to get the next question can u plz tell me the solution  Hi friend, For Jsp pagination application
Servlet-JSP population - JSP-Servlet
Servlet-JSP population  Hi, this is regarding my previous question... and display in the next page. I changed my servlet code something like this but i find some problem retrieving the values from the jsp page. As my cart in jsp
jsp definition - JSP-Servlet
. Here one thing u have to observe jsp page----->JSPCOMPILER---->SERVLET...jsp definition  is jsp a client side programming language or server... that is embedded in jsp's. If any HTML code in jsp's is placed in out.println("HTML
Servlet - JSP Programming - JSP-Servlet
Servlet - JSP Programming  Hi, I'm writing a jsp page as shown... to cart or checkout). I'm programming in a servlet getting the input parameters... servlet code is also pasted below. please let me know how to solve
Servlet-JSP population - JSP-Servlet
Servlet-JSP population  Hi I have a login page which accepts inputs and take to a servlet, servlet makes a jdbc connection to oracle server... in I redirect to a JSP page which populates a list of items available

Ads