This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Passing a value to a settimeout method using jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing a value to a settimeout method using jsp" Watch "Passing a value to a settimeout method using jsp" New topic
Author

Passing a value to a settimeout method using jsp

Saumyaraj Zala
Ranch Hand

Joined: Aug 06, 2012
Posts: 56

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.



Why do we fall? So that we can learn to pick ourselves up.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

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

  • ,


    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Saumyaraj Zala
    Ranch Hand

    Joined: Aug 06, 2012
    Posts: 56

    Thanks, next time i would follow these practices but for now can you please tell whats getting wrong?
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60800
        
      65

    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

    Joined: Aug 06, 2012
    Posts: 56


    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
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60800
        
      65

    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

    Joined: Aug 06, 2012
    Posts: 56

    There was a silly mistake in my SQL query.
    Thank you for your suggestions. :)
     
    Consider Paul's rocket mass heater.
     
    subject: Passing a value to a settimeout method using jsp
     
    Similar Threads
    Problem in Login page
    How can I catch the radio button action in jsp?
    Retrieving contents of more than one table in jsp
    Passing a variable of a jsp page to a setTimeout method.
    How to getParameter value