i will provide a code for magic square. you have take servlet package and make a t class from the html class you have to request to another class after entering the values. in this its dealing with servlets
using Apache tom cat.
you can use the presentation i uploaded with this .