Captcha creating in servlet
A captcha is a type of challenge-response test used in computing to determine whether the user is human. Captcha is a contrived acronym for "Completely Automated Public Turing test to tell Computers and Humans Apart". (Wikipedia) Using captchas...
Save SqlQuery result to FlatFiles
public void printToFile( ResultSet rs, String path ) throws IOException {
PrintStream out = new FileOutputStream( path );
int cols = rs.getMetaData().getColumnCount();
while( rs.next() ) {
for( int i = 0; i < cols ; i++ ) {
out.printf("%s,", rs.getObject( i ) );
}
out.println();
...
Login System Using Servlet
In this example we will show you how to develop a login form using servlet. Here we are using MySqldatabase. List of file to be created are:
index.html
Login.java
Validate.java
Welcome.java
web.xml
To try this application you will need to create...
Run Servlet Application Using Eclipse IDE
Eclipse IDE is the most popular Java IDE used in the Industry. It is developed by an open source community and can be downloaded for free from Eclipse.org
Steps to create Servlet using Eclipse IDE
To create a Servlet application...
Process for creating servlet using Tomcat Server
To create a Servlet application you need to follow the below mentioned steps. These steps are common for all the Web server. In our example we are using Apache Tomcat server. Apache Tomcat is an open source web server for testing servlets...
How to copy data from one table to another
If you don't want to list the fields, and the structure of the tables is the same, you can do:
INSERT INTO `table2` SELECT * FROM `table1`;
or if you want to create a new table with the same structure:
CREATE TABLE new_tbl [AS] SELECT * FROM orig_tbl;
Example::
SQL> INSERT INTO COURSES SELECT * FROM STUDENT;
6 rows created....
ASSERT IN JAVA
The assert keyword is used in assert statement which is a feature of the Java programming language since Java 1.4. Assertion enables developers to test assumptions in their programs as a way to defect and fix bugs.
Syntax of assert statement
Syntax of an assert statement is as follow (short version):
assert expression1;
or...