• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Best way to model an 'exam' web-app

 
Ranch Hand
Posts: 112
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm designing a short web application that poses around 20 questions to the user and evaluates them. I have a query on this. To start off, i have a login screen where the user is required to enter the user name and employee id. Once that is done, I will pose the questions to the user and once he answers them and hits the submit button, the results would be evaluated.

login->questions->evaluate. I wanted to know what is the best way of doing this. Somehow I need to track of who has logged in and is taking the test. So, should I be opting for the cookies approach or is there a better approach for doing this?

Please suggest.

Thanks,
Pavan.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Speaking from the advantage of having done a bunch of online exams....

Since some people will have cookies turned off on their browser, I use a hidden variable in each HTML form containing a unique user id.

I also use a custom class to hold all of the user's information, current position in the question list, answers so far, etc and eventually the grade. This class is Serializable so I have to option to write a user's state to disk after each question is answered. This allows a user to stop in the middle of the test and resume later or go back later to look at the graded results.

Think carefully about how you are going to create and store the question set. Personally I use XML.

Bill


 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see someone is stuck with creating an internal app for surveys :-D There are a myriad of approaches to take and using stock Servlets and JSP seem to be a bit backdate because theer are so much frameworks out there that will make your life much easier. That said you may not want to learn them and/or use them in your application if you won't be extending it much. But you never know!!

There are several stacks you can use to make a web application like that. Most of the web apps go the MVC(http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) way so I'll post the stacks that I'm aware here.

Model - POJOs(http://en.wikipedia.org/wiki/POJO) with an ORM framework like JPA,Hibernate MyBatis/iBatis, you can also use plain JDBC although out of the box it's a bit cumbersome.

View - JSPs is the most basic element but its best served with a framework like JSF, Struts, Spring MVC

Controller - You can do this with a servlets and some java classes with business logic however use of an MVC famrwork mentioned in the View part is highly recommended

And if you are using plain JDBC using Spring built in templates will make your life easier.

Again the choice depends on your plans and/or expectations for the application. If you are not familiar with the frameworks mentioned and you don't expect the application to evolve to do anything other than whats mentioned here(if it's a class project ) then you are best off with Servlets and JSP with JDBC or an ORM. However learning the frameworks wil only help you in the long run!
 
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What if it is not a class project? Servlet,jsp and Hibernate will do?
 
Thihara Neranjya
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would yes. But if you used on of the frameworks extension will be faster. But if you design it properly and use good coding practices servlets and JSPs would serve you well.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thihara Neranjya wrote:It would yes. But if you used on of the frameworks extension will be faster.


I disagree. If the framework is not something someone is already familiar with it will take much much longer. And even then, the frameworks frequently get in the way more than they help -- especially for smaller projects
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Thihara Neranjya. i am working on such app and i don't have much time to use framework like Spring. Later on, will convert the codes to Spring, that's for sure
 
Thihara Neranjya
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

Thihara Neranjya wrote:It would yes. But if you used on of the frameworks extension will be faster.


I disagree. If the framework is not something someone is already familiar with it will take much much longer. And even then, the frameworks frequently get in the way more than they help -- especially for smaller projects



I agree with you... That's why I said if he's not planing on extending it as a large scale application he should use JSPs and Servlets. Actually Kunal if you are not planing on extending the application and/or want to learn some of the frameworks it would be a waste of effort.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Thihara Neranjya, Bear Bibeault.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic