• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tricky logic problem in JSP

 
Ranganath .S.Junpal
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

Firstly , I would like to wish a Happy New Year..

As far as my questions are concerned.. I am doing a project for a Quiz or online test.
I wanted to know how to provide 4 options using a Radio Buttons. and get the Options once a candidate checks that Radio Button and obviously the candidate should not be able to check the 2 radios. i am bit confused in findin a logic for that..

secondly I would like to have a timer which moniters the test. Once the Time elapses it will automatically log out of the session. The latter part ie logout thing is handled .. but my question is that how to code for a Timer... Yes i know to take the sys date and subtract.. N stuff.. but then i want to build a timer which is not dependent on the system.

I would like to know if i can get any code snippet for this timer. I did wrote a timer in javascript. but the problem was that once i refresh my timer use to get reset. so it was all in vain.

Any help regarding this would be appreciated

Thank you
Regards
Ranganath.S
[ January 03, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of this is client-side activity that must be implemented using Javascript and HTML.

Firstly, if you name the radio buttons using the same name, they become a radio group and the user will only be able to pick one.

With regards to the timer, you'll need to do that in Javascript. But if you maintain the timer info in the session, you should be able to figure out how to initialize the timer to the appropriate value upon a page refresh.

For now, I'll leave this here in the JSP forum for any discussion as to maintaining the timer value on the server.
[ January 03, 2006: Message edited by: Bear Bibeault ]
 
Ranganath .S.Junpal
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your kind response. I know that if the Radio Button is given a same name i would be able to pick one at the time. But the problem is say i have a Radio Button one,two, three and four. if i check a first Radio Button. how do i retrieve it.. one way of doing is by usin document.frm.compname.value and check for its trueness or falseness of the state and process it.. but the problem is that all the Radio Buttons have the same name and secondly how to get the Answers attached with these radio Buttons.

As far as the Timer is concerned. i wasnt clear with your suggestion.. Please let me know clearly.

Thank you
Regards
Ranganath.S
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can access radio buttons in Javascript via an array whose name is the name given to your radio group ('mybuttons' in the example below).

For example :



About the timeout, you could set it in your web.xml,
using the <session-timeout> tag under <session-config>.
[ January 03, 2006: Message edited by: Satou kurinosuke ]
 
Ranganath .S.Junpal
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satou kurinosuke- Thanks a lot.. Timer thing did gave an idea.. N i cracked the java script thing too..


Thanks a lot!
 
kiranreddy reddy
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranganath

Did you get that timer thing using java script or session Time out, I need to achieve some similar functionality, so I am curious about that. If u can plz tell how u have done that

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kiranreddy reddy:

Did you get that timer thing using java script or session Time out


Trying to use the session time-out as a timer would not be a good idea.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kiranreddy reddy, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
Forum Bartender
 
kiranreddy reddy
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry about that. I will take care of that in my future posts

Thanks for informing about this
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!