• 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

JSP - How to Create a Mock Exam

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

we were planning to create a online mock exam using JSP and Servlets. Someone please assist us a logic or example code to do that.

Thanks
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Store questions and answers in a database, show them on the screen, keep a tally of correct/incorrect answers, display said tally at the end.
 
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
I have been doing mock exams for years.

1. Store questions in an XML file - advantages easily edited, can add new elements without affecting the existing code. So if somebody says now we want images in a question, you can add the new question format.
2. Display entirely from servlet - there is utterly no reason to confuse things by mixing in jsp.
3. Learn to use CSS to control appearance
4. Make mockups in straight HTML first
5. For all but the most simple subjects, put a lot of effort into making it easy for question authors.

Bill
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that #2 would be (and in my opinion, *should* be) considered a bad practice, and has been for years.

I'd also strongly advocate against #1; it disallows trivial remote Q/A administration and introduces a few other issues as well.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
William usually gives sound advice, but I concur with David on this one. HTML has just as little place in Java code, as Java code has in a JSP.
 
William Brogden
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
Sorry guys you are just regurgitating doctrine, not thinking clearly.

There is nothing to be gained by involving extra steps involved in JSP.

Bill
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:Sorry guys you are just regurgitating doctrine, not thinking clearly.


Sorry, but I'm not. Far from it. This comes from over 10 years experience in developing web applications. Trying to maintain HTML code that's been built up in Java strings in a servlet is nothing short of a nightmare -- especially if, as in most modern web applications, a good deal of JavaScript is involved.

There is nothing to be gained by involving extra steps involved in JSP.


We'll just have to disagree. I think a JSP is the right tool for the job for all but the most trivial cases (trivial meaning single-line responses).

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:Sorry guys you are just regurgitating doctrine, not thinking clearly.


That's rude, I think my thinking is almost always quite clear.
 
William Brogden
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
My experience with web applications is also extensive and I have seen a lot of inappropriate use of technology just because it was the latest and greatest. JSP is justified for web applications dominated by static HTML content.

The content of a HTML page presenting a question in an on-line exam is almost entirely built dynamically from the current state of the exam. There is little that JSP can contribute to this creation. Keep in mind the well known principle (stated 3 ways)

1. K.I.S.S.
2. as Simple as possible but no simpler
3. [url=http://en.wikipedia.org/wiki/Occam%27s_razor]Occam's razor [/url] "entities must not be multiplied beyond necessity."

Adding more tools to Java has expanded the capability but many applications don't need the full set. A google search for "has java become too complicated" got me 399,000 hits. This build up of complexity followed by invention of "simplified" languages just seems to occur naturally in the computing world.

Bill
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William wrote:There is little that JSP can contribute to this creation.


As Bear said--we'll have to agree to disagree.

The "java has gotten too complicated" argument is specious at best, and about as weak an argument as could be made for what we're talking about here.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In case if my mock test contains 25 questions. Can I read all the 25 questions at a time from database or 1 by 1 from the database.

I guess Beteer solution will be reading 25 in a single shot and load it in list.

Please suggest
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read them all at once.
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic