Archive for the ‘Java’ Category

Employee Registration using Spring MVC

To download code –Click Here

web.xml File

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>Spring3MVC</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>

    </servlet>
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>*.htm</url-pattern>
    </servlet-mapping>

</web-app>


spring-servlet.xml File

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"

Read more »

Java Program 20 – Flight Management

Program

import java.util.ArrayList;
import java.util.Iterator;
import java.io.*;

class Route{

    String routeId;
    String routeOrigin;
    String routeDestination;
    String routeDate;
}

class Flight{

    String flightId;
    String flightName;
    String flightOrigin;
    String flightDestination;
    String flightDate;
    ArrayList<Route> routeArray=new ArrayList<Route>(10);
}

class FlightManagement{

    ArrayList<Flight> flightArray=new ArrayList<Flight>(10);
    Route route;

    public void addFlight(Flight newFlight){
    
        flightArray.add(newFlight);
    }
    

Read more »

Java Program 19 – Database Connection using jdbc:oracle

Program


import java.sql.*;

class Jdbc{

    Connection connection=null;
    Statement stmt=null;
    ResultSet rs=null;
    
    public Jdbc(){
    
        try{
        
            Driver driver=new oracle.jdbc.OracleDriver();
            System.out.println("Driver loaded");
            String url="jdbc:oracle:thin:@192.168.25.178:1521:xe";
            java.util.Properties userCre=new java.util.Properties();
            userCre.put("user","litmus");
            userCre.put("password","litmus");
            connection=driver.connect(url,userCre);
            System.out.println("Database connected");
            
        }catch(Exception e){
        
            System.out.println("Error 1 : " + e);
        }
    }
    

Read more »

Last updated by at .