DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: Online voting !!

  1. #1
    Join Date
    Nov 2005
    Posts
    4

    Online voting !!

    Hi there i am a final year student and i was thinking of creating an internet voting system for uni student using JSP, servelets and javabeans. Really need tips on how i could go about building the system. I would really appreciate any help i get. Thanks

  2. #2
    Join Date
    Nov 2005
    Posts
    10
    Hello to you!

    Well you may use SJS Java 8.01 as your server and after that all you have to do is to
    create a few entity beans and servlets (or/and JSP).
    You can "read" with the servlets from your HTML form (form for voting) and give the
    information to the entity bean who stores them in a database for furter use.

    NetBeans can help you to do that!!!

    If you want much more detail tell me and I'll send you some code samples!!!Also
    you must be a little more exact of what you want.

    Have a nice day...

  3. #3
    Join Date
    Nov 2005
    Posts
    4
    Quote Originally Posted by AnghelLeonard
    Hello to you!

    Well you may use SJS Java 8.01 as your server and after that all you have to do is to
    create a few entity beans and servlets (or/and JSP).
    You can "read" with the servlets from your HTML form (form for voting) and give the
    information to the entity bean who stores them in a database for furter use.

    NetBeans can help you to do that!!!

    If you want much more detail tell me and I'll send you some code samples!!!Also
    you must be a little more exact of what you want.

    Have a nice day...
    Hi there
    Thanks for the information you gave me. I am planning to build a secure Internet voting system for my university's student union, i wanted to make the system able to process votes for candidates and display the results in some graphical form. The main security issue that has to be addressed is a method of preventing individuals from voting more than once for one candidate. I was planning on creating sections for voters, candidates and adminstrators. I would really appreciate it if you could give me more ideas on how i could go about building my system, any code samples you can send me will be highly appreciated. Thank you. Email: chibuzor2001@yahoo.com

  4. #4
    Join Date
    Nov 2005
    Posts
    10
    Hello,
    I will give you some samples but please wait until Monday.

    Have a great weekend...

  5. #5
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    253
    Quote Originally Posted by AnghelLeonard
    Hello,
    I will give you some samples but please wait until Monday.

    Have a great weekend...
    It would be good if you specified which Monday you are talking about.
    Happiness is good health and a bad memory.

  6. #6
    Join Date
    Nov 2005
    Posts
    4
    Quote Originally Posted by AnghelLeonard
    Hello,
    I will give you some samples but please wait until Monday.

    Have a great weekend...
    Thanks alot i really appreciate your help. Hope to receive the info from you on monday.

  7. #7
    Join Date
    Nov 2005
    Posts
    10
    Hello, I am talking about this Monday...

    Here are the basic source file that you need for your application. You must
    add your code and than compile,deploy and run the app.
    The web page will be an .jsp (this code just link the entity bean - you must add the html tags) that let you read the information and store them to
    a database created by the following script:

    drop table vot;

    create table vot
    (id varchar(3), constraint pk_police primary key,
    name varchar(25));

    exit;

    Now the .jsp:


    <%@ page import="VOTING.LocalVoting, VOTING.VotingHome, javax.ejb.*,java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>
    <%!
    private LocalVoting LV = null;

    public void jspInit() {
    try {
    InitialContext ic = new InitialContext();
    Object objRef = ic.lookup("java:comp/env/ejb/TheVoting");
    VotingHome home = (VotingHome)PortableRemoteObject.narrow(objRef, VotingHome.class);
    } catch (RemoteException ex) {
    System.out.println("Couldn't create converter bean."+ ex.getMessage());
    } catch (CreateException ex) {
    System.out.println("Couldn't create converter bean."+ ex.getMessage());
    } catch (NamingException ex) {
    System.out.println("Unable to lookup home: "+ "TheVoting "+ ex.getMessage());
    }
    }

    public void jspDestroy() {
    LV = null;
    }
    %>
    <html>
    //put your html tags here
    //from here you may call the method from the LocalVoting interface
    </html>

    And the entity bean:

    LocalVoting.java

    package VOTING;

    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;

    public interface LocalVoting extends EJBObject{
    //put here your methods and implement them in the VotingBean
    }

    VotingHome.java

    package VOTING;

    import java.util.Collection;
    import java.rmi.RemoteException;
    import javax.ejb.*;

    public interface VotingHome extends EJBHome{

    public LocalVoting create(String id,String name)throws RemoteException,CreateException;
    public LocalVoting findByPrimaryKey(String id)throws FinderException,RemoteException;
    }

    VotingBean.java

    package VOTING;

    import java.sql.*;
    import javax.sql.*;
    import javax.ejb.*;
    import javax.naming.*;
    import java.util.*;

    public abstract class VotingBean implements EntityBean{

    private EntityContext context;

    //the SQL for this methods are settle in the deploytool in EJB QL format
    public abstract void setID(String id);
    public abstract void setName(String name);

    //ejbCreate method
    public String ejbCreate(String id,String name)throws CreateException
    {
    setID(id);
    setName(name);

    return null;
    }

    //ejbPostCreate method
    public void ejbPostCreate(String id,String nume)throws CreateException{}

    //setEntityContext method
    public void setEntityContext(EntityContext context)
    {
    this.context=context;
    }

    //ejbActivate method
    public void ejbActivate(){}

    //ejbPassivate method
    public void ejbPassivate(){}

    public void ejbStore(){}

    //ejbLoad method
    public void ejbLoad(){}

    //metoda unsetEntityContext
    public void unsetEntityContext()
    {
    context=null;
    }

    //ejbRemove method
    public void ejbRemove(){}
    }

    I hope this is ok...more information in J2EE tutorial...

  8. #8
    Join Date
    Nov 2005
    Posts
    4

    Thanks

    Hi thanks for the information, really appreciate, please do u have an idea on how i can prevent voters from voting more than once for a single candidate.I also need to find a way of making sure that a voter is eligible to vote, like identity checks. Thanks

  9. #9
    Join Date
    Nov 2005
    Posts
    9
    Try to register the user in a database and verify him when he try to vote (ask him for a password and e-mail address).
    You must understand that what you want is possible only if the user is a "good man".
    Take a look to all voting online system. Per example to the VMA there are users that
    vote all night the same person. He just create a new account every time.
    Anyway a good idea is to follow the usual way ask a password and a e-mail.
    If a user is already in your database verify if he vote before and for who.
    The HTML form (or JSP etc.) must suply a checkbox system in such a manner that only one canditate can be selected.
    I hope this help...

Similar Threads

  1. OVERSEAS Online Data Entry Information
    By jai in forum Careers
    Replies: 0
    Last Post: 02-21-2003, 12:43 AM
  2. DTD for Online Help?
    By andyz in forum XML
    Replies: 0
    Last Post: 11-26-2001, 01:51 PM
  3. Achieve both online and offline
    By Hu Ji Rong in forum Java
    Replies: 0
    Last Post: 05-27-2001, 11:47 PM
  4. development of online dss
    By philys in forum ASP.NET
    Replies: 0
    Last Post: 09-04-2000, 07:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center