• 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

Passing a value to a settimeout method using jsp

 
Ranch Hand
Posts: 75
Eclipse IDE AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to jsp and servlets and making a Online Examination project. I want a exam(jsp page) to be submitted after a particular time interval(fetched from database). I am not able to get the time from database and the settimeout method is only taking the initial value of the time variable. Please see the code below. Thankyou.

 
Sheriff
Posts: 67747
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
If you are new to JSP, you are heading down the wrong path right away. Modern JSP has no Java code in the pages. None. You should be putting Java code in servlets and other classes. Within the JSP you should be using only the JSTL (JSP Standard Tag Library) and the EL (Expression Language).

I also recommend reading these articles:
  • The Secret Life of JSPs
  • The Front Man

  • ,
     
    Saumyaraj Zala
    Ranch Hand
    Posts: 75
    Eclipse IDE AngularJS Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks, next time i would follow these practices but for now can you please tell whats getting wrong?
     
    Bear Bibeault
    Sheriff
    Posts: 67747
    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
    Next time is not the correct thine. This time is. Why spend time learning how to do things the wrong way?

    But if you insist on spending time do things poorly, you'll need to be specific about the problem and where it is. There's just too much code in that page to pick it out by inspection.
     
    Saumyaraj Zala
    Ranch Hand
    Posts: 75
    Eclipse IDE AngularJS Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Actually i want the time interval that this setTimeout method will have to be fetched from a table in a database and for that i made a resultset r1 in my code above and then after fetching that time interval i copied that in variable "t" which was fed to my setTimeout method. This is an online test so my setTimeout will have different time interval for each test.
     
    Bear Bibeault
    Sheriff
    Posts: 67747
    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
    Again, that's all stuff that should be handled by the controller and other Java classes.

    What's not working about your timeout now? What HTML is being sent to the browser? That's all that matters. Have you checked it?
     
    Saumyaraj Zala
    Ranch Hand
    Posts: 75
    Eclipse IDE AngularJS Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    There was a silly mistake in my SQL query.
    Thank you for your suggestions. :)
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic