Solved

Voting servlet with java

Posted on 1998-10-21
4
371 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now