devxlogo

Tip Bank

JSP and the Introspection Process

The introspection process allows the JSP engine to populate a JavaBean with the values provided by a client through an HTML form. //when the names of the bean properties match

Execute a SQL Statement with Variable Parameters

When you need to execute the same SQL statement (in general an UPDATE) multiple times with different parameter values you can use the PrepareStatement method like this: Connection conn=null;PreparedStatement pst=null;String[]

Convert a java.util.Date Object to a java.sql.Date Object

The following code demonstrates how to convert a java.util.Date object to a java.sql.Date object: import java.sql.*;import java.util.*;public class cs{public static void main(String[] args) { GregorianCalendar date_1=(GregorianCalendar)Calendar.getInstance(); System.out.println(date_1.getTime()); java.sql.Date date_2= new

Using the SecureString Class

NET 2.0’s System.Security namespace includes the SecureString class, which lets you create encrypted strings and delete them from memory when they’re no longer needed. You can even make a string

Send Emails Through SMTP in .NET

When sending emails via SMTP in .NET, developers seldom check to ensure the SMTP service is installed and running. Here’s some code to perform the check and start the service

Compressing a File with MS Visual J# .NET

The Microsoft Visual J# .NET 1.1 Class Library (vjslib.dll) contains methods you can use to compress a file. The following code demonstrates how to use them. /* Code to zip

The Enhanced for loop in Java 1.5 (5.0)

There have been a lot of enhancements to existing features in Java 1.5 (5.0). One of the simplest improvements is to the most commonly used for loop. Here’s how it