This is similar to IRCTC in small scale.
This is implemented using Servlet, JDBC and HTML. In this you can save your ticket in any of the trains, and get the ticket whenever you want. In the back, MySQL database comprising of 2 tables is used. One table contains information about trains and the seat left in SL, AC3, AC2 in respective train. other contains information about ticket booked like : name, number of seat, boarding_station, destination_station, train, category.
Interface for this is in HTML, and logic is in servlet.