Hi,
My project is on "Online Voting System"...it has 2 users 'admin' and 'voter'.The login of voter is done.Now what needed to be done is after loging in a jsp page will be displayed in front of the voter which will show all the candidates name and an option botton with each name ,so the voter has to select 1 candidate and then click the submit button.This jsp page is redirecting to a servlet which shoul increase the number of votes of that particular candidate and it should also update the voters 'voted' attribute to '1' which means the voter has voted and can't vote again.So i have written the code(jsp,xml and servlet) and the servlet has compiled properly and even not giving any exception but its not doing its job ..that is not increasing the number of votes of the candidate n niether updating the value of the voter to '1'.When the 'submit' button is clicked then a page get opend which says "Thankyou null.you have successfully voted"..this page is being redirected from the servlet.
please help me find out the problem.

The jsp code

html4strict Code:

[HTML]



My Page



CAST &nbsp&nbsp YOUR&nbsp&nbsp VOTE


[COLOR=#ddbb00]


CANDIDATES NAME
VOTE

[COLOR=#009900]






[/HTML]

The Servlet Code

Code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class CastVote extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServleResponse response)throws ServletException,IOException
{
cid=request.getParameter("id");
vid=request.getParameter("uid");
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:zeal");
PreparedStatement ps=con.prepareStatement("update candidate set no_of_votes=no_of_votes+1 where id="cid");
ResultSet rs=ps.executeUpdate();
con.close();
}
catch(Exception e)
{
}
}

thankyou.



http://forums.masr.me