Solved

Voting servlet with java

Posted on 1998-10-21
4
384 Views
Last Modified: 2013-11-24
I should develope a voting system with java. This means a html-page representing buttons. When you vote, you press one. Then your answer will be added to a database ( a counter of voting results).

Probably this could be done by a java servlet.

I'd be happy if someone could give some hint how to do this.
Or maybe somebody allready done something similar.

Timo
0
Comment
Question by:kojonen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:vendrig
ID: 1226043
It doesn't sound too difficult. You really want to use a database? What are the restrictions? What do you want to log, just the counter? Or several counters?
BTW: starting blanco, I wouldn't use Java, I'd use ASP or another scripting-environment. Client-side you don't need Java, and server-side you just need to insert or update database records, or maybe just write to a simple file.
0
 
LVL 5

Accepted Solution

by:
msmolyak earned 200 total points
ID: 1226044
I agree that client side can be done without Java (HTML should suffice). However I do not see a reason not to use Java servlet on the server side, especially if you are confortable with Java. If you data storing requirements are simple you indeed can use Java serialization or a flat ASCII file on the server to store data persistently.

If you want to develop a servlet you need
- Servlet development kit which you can download from java.sun.com. It includes the classes supporting servlets (javax.servlet.*  packages).
- To make sure that your Web server is servlet enabled. If it is not you need to get a patch which makes it such. I've used JRun from Live Software with my IIS (the free version) and it worked without a hitch. Sun has a listing of those server plug-ins which make Web server servlet-enabled.

There are many servlet tutorials around (one is on Javasoft's site) which explain what the servlet API is about and how to use it. The essense is simple: the servlet can receive requests from the client and send responses back (it is in concept very similar to CGI). There are plenty of convenience methods to parse the request and format the response.

Let me know if you need more info.
0
 
LVL 4

Expert Comment

by:seguret
ID: 1226045
If you want to make something simple, you don't even need to use a servlet server. The http protocol is very simple. You can make in 20 lines of code a server that answers to requests and doesnt need any software other than a java VM.
If you're planning to let your application grow, so it's better to use a servlet server or something like this.
0
 

Author Comment

by:kojonen
ID: 1226046
Thanks !

This is what I asked. But please check out the next question (more details) too !

T.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question