Date operation

Ads

 
 
 

Share on Google+Share on Google+

Deebapriya
Date operation
1 Answer(s)      8 years ago
Posted in : JDBC
Ads
View Answers

July 15, 2008 at 6:38 PM


Hi friend,


<html>
<head>
<title>registration form in jsp</title>
</head>

<body>
<table border="1" width="50%" bgcolor="pink">
<tr>
<td width="100%">
<form method="POST" action="dateCastAction.jsp" >

<h2 align="center">Employee registration form</h2>
<table border="1" width="100%">
<tr>
<td width="50%"><b>User id:</b></td>
<td width="50%"><input type="text" name="userid" size="5"/> </td>
</tr>
<tr>
<td width="50%"><b>Employee Name:</b></td>
<td width="50%"><input type="text" name="name" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Department Name:</b></td>
<td width="50%"><input type="text" name="dept_name" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Date of Birth:</b></td>
<td width="50%"><input type="text" name="date" size="20"></td>
</tr>

</table>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>

</form>
</td>
</tr>
</table>
</body>
</html>
----------------------------------

dateCastAction.jsp

<%@ page language="java" import="java.sql.*,java.util.*,java.text.*" %>

<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";
java.util.Date date;
String s=null;
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
try{
Statement st = con.createStatement();
String userid=request.getParameter("userid");
String name=request.getParameter("name");
String dept=request.getParameter("dept_name");
String dat= request.getParameter("date");


int val = st.executeUpdate("insert userSearch values('"+userid+"','"+name+"','"+dept+"','"+dat+"')");
con.close();
out.println("Successfully insert Date into database.");
out.println("<br/><a href=searchForm.jsp><b>Back to Register Form</b></a>");
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>

--------------------------------------------

Thanks.

Ads









Related Tutorials/Questions & Answers:
Date operation - JDBC
Date operation  can anybody help me how to cast a java.util.Date... DateFormatTest { public static void main(String[] args) { Date date = Calendar.getInstance().getTime(); // Display a date in day, month, year format
Date operation - JDBC
Date operation  The same what i asked already.Still i didnt get... the html text obj into sql Date obj?  Hi friend, registration...: Department Name: Date of Birth
Advertisements
Calendar Operation
Calendar Operation  I have a date - example - 22-09-2012(start date) I have to find my end date based on the current quarter My input are month... is 23, it falls tomorrow and is not yet over so my end date should be calculated
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
Searching operation in JAva
Searching operation in JAva  Sir, I have made a project... on a particular date. Now there are thousands of letters dispatched on a particular date. I want to refine my search. Can anybody plz tell me how can I perform
Search operation in JSP page
Search operation in JSP page  How to perform search in jsp with MYSQL database plz help me
search operation - Java Beginners
search operation  how to retrive all the similar elements (search operation ) on xml document using regular expressions
Insert Operation Error - WebSevices
Insert Operation Error  Hai, How i store my full resume in database[Mysql] using PHP. Any one Know the code..... Help me
date
date   how to insert date in database? i need coding
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
Java code for buffer operation...!!!
Java code for buffer operation...!!!  Implement a buffer operation using character array, storing last 100 characters inserted by user. Make method to get and retrieve???   The given code accepts the characters from
login/logout operation
login/logout operation  how to do log in/out operations in jsp plz kindly send the steps leing behind this operation  
arithmetic operation on float number
arithmetic operation on float number  hi here is my code class divs { public static void main(String args[]) { double dub=14.2f,dou; int num; num=(int)dub; dou=dub-num
date
date  i want difference between the date entered in a jtextfield and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
database table name birthday (DOB date); dob with DATE data type in database while...=d.getTime(); java.sql.Date date = new java.sql.Date(t); try { System.out.println(date); Class.forName("oracle.jdbc.OracleDriver"); con
DATE
DATE  I have the following as my known parameter Effective Date... of calcultion starts My question is how to find the date of Thursday This cycle... the date of all the thursdays of the given year. import java.util.*; import
Mysql Time Operation
Mysql Time Operation       Mysql Time Operation performs the subtraction and addition of time. Understand with Example The Tutorial illustrate an example from Mysql Time Operation
Push and Pop operation of stack.
Description: In this tutorial of data-structure you will see push and pop operation of stack. In the previous tutorial is clearly explained the push pop operation. The drawback of implementing stack is that the size of stack
Using JOINING Operation in JDBC
Using JOINING Operation in JDBC    Whenever we need to select data from two or more tables, we have to perform a join operation. Tables in a database can be related to each other with keys
how to do CRUDE operation in iphone?-RV
how to do CRUDE operation in iphone?-RV  .h file #import <sqlite3.h> @interface RootViewController : UIViewController { IBOutlet... = "insert into photo_table(photo_name,photo_date) Values
java.sql.SQLException: Operation not allowed after ResultSet closed
java.sql.SQLException: Operation not allowed after ResultSet closed  package processing; import java.io.; import java.math.BigDecimal; import java.sql.; import java.util.*; public class Processing { public static void
Html+jsp+database is enough to do the small operation
Html+jsp+database is enough to do the small operation  Hai , If u want to do simple insetion and data retrival operation throw jsp ?.you need not to bother about whole code.just u consentration on html,ajax,jsp,any db.here i
date format - Date Calendar
date format  how to convert dd-mmm-yyyy date format to gregorian... to convert date to calender. import java.util.*; import java.text.*; public...="19-Sep-2008"; DateFormat format ; Date date ; format = new
Tutorials   
Java Spring Hibernate Struts Training java.lang.classnotfoundexception com.mysql.jdbc.driver how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu

Ads

 
Advertisement null

Ads