• Post Reply Bookmark Topic Watch Topic
  • New Topic

Logic needed for Survey tool

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I'm creating an online survey tool wherein I have a set of questions with some radio button options in it. Whenever I'm creating a survey, I can set the conditions like for example, I select question 1 which has 5 options for it and based on the options that I select, I will be taken to question 2 and so on. I want to implement this logic using java/jsp/servlets. The jsp/servlet part is later but for now I want to know what packages in java that will help me do this??
[ May 17, 2007: Message edited by: Jothi Shankar Kumar Sankararaj ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question. Moving...
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any help guys?
 
Praveen Reddy
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can achieve this by using java script & by using Switch case in jsp page or you can use Ajax
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't we do it by just writing classes??
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure exactly what kind of answer you are looking for. If the problem is that you need to keep accumulating answers from previous pages when you're displaying the next one, then you can use an HTTP session to do that.

It is probably best to keep the code that displays the pages and collects the results generic. That means that the server reads the survey description from a file, where the questions to display and the types of answers expected (text, checkbox, radio buttons) is listed for each page. Then you can use the same code later (or even simultaneously) for other survey.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf,

It has to be done this way, I have a tool wherein the administrator can actually select the questions for today's survey and branch out conditions based on his selection.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a tool wherein the administrator can actually select the questions for today's survey and branch out conditions based on his selection.


So that means that the questions for each survey are stored in a DB? That's even better than a file.

But in that case I don't understand what exactly you are asking or need help with.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf,

If you see some commercial survey tools, the questions that appear on the survey changes according to the user's response. I want to create a system which has a set of say 50 questions with 4 options to select (in the form of radio buttons). Now I'm the administrator, so I log on to the system and I configure the questions. Like I select 10 questions for a survey and I can configure those 10 questions in such a way that based on the answer for the first question, I will be directed to the next question or questions 3 and so on. I want to implement this logic. I have alreday done a sampling of it using a database, but I want to know if I can create a generic class without a database that can handle such a situation??
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have alreday done a sampling of it using a database, but I want to know if I can create a generic class without a database that can handle such a situation?


You can certainly do that, but why would you? If the data isn't stored anywhere, what would the application do if the server went down? All data would be lost.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to implement this logic. I have alreday done a sampling of it using a database, but I want to know if I can create a generic class without a database that can handle such a situation??


Of course you can create a class that defines all the possible flows of users through a survey in terms of the question numbers from some master list. Make it serializable so it can be saved and restored if the server restarts. Given that you want to handle branching in the survey this class is not going to be simple.

Remaining questions:
1. Whats the form of the master list of questions? (I would use XML since you don't want to use a database)
2. How do you maintain the history of a given user's responses?
3. How do you save that history for analysis?

Bill
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
.... what would the application do if the server went down? All data would be lost.

What about doing a file open, say in init(), and partially writing the file.

If the server goes down (unexpected condition) there's a mess to clean up anyway - something I am giving deep consideration to in my main() class - and a partially written file may or may not be recoverable due to issues reservered to the underlying OS [correct ?] so it's a productive challenge, but I like the original poster would rather write things in a class where I could see exactly what was going on.

Note: I recognize that this approach tends to incite deep loathing in some Grand Masters.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!