Online Voting System

Only available on StudyMode
  • Topic: JavaServer Pages, Java, Voting
  • Pages : 4 (1166 words )
  • Download(s) : 283
  • Published : May 29, 2013
Open Document
Text Preview
 
Michael Chinwuba 03058068
66
8.5 Admin Implementation
Index.html page
: acts as the welcome page which provides links to the voter and adminlogin pages. AdminLogin jsp page:
 provides dynamic access to the system, it is responsible for sending http requests to the adminlogin servlet in form of the login data retrieved fromthe administrator, the page is also used to set the value of the properties of the message java bean in a tag as shown in figure 8-6, which displays errors message from thedatabaseconnection class and adminlogin class.Figure 8-6: The code above displays the tags used to declare and instantiate the message java bean, it is also used to set the value of the java beans properties. AdminLogin Servlet class:

retrieves http requests from the AdminLogin jsp page, getsthe username and password parameters, it encrypts the password parameter by calling theEncryption.encrypt method from the Encryption class located in the datasource package.The servlet ensures that the user is of type two, which is the type number for theadministrators by calling the Authenticate method in the databaseconnection class. If theuser is an administrator the user is then permitted access to the AdminMenu jsp page, if the user is not an administrator, error message is generated in form of a message java bean and the user is directed to the adminlogin jsp page through the use of the getRequestDispatcher method as shown in figure 8-7.<P></FONT><jsp:useBean id="Message" class="beans.Message" scope="session"></jsp:useBean><jsp:getProperty name="Message" property="message" /><BR>

 
Michael Chinwuba 03058068
67Figure 8-7:
The code above displays the validation used in the adminLogin class AdminMenu JSP page:
contains all the links to the add, delete and view candidates,voters and administrator jsp pages. It also contains a link to the welcome page. Add Voter JSP page:
is used to add voters details into the database dynamically.  ...
tracking img