Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 617
  • Last Modified:

How do I set an auitomatic refresh on a jsp page

I have some code within a jsp which runs through and creates a html page. However at a certain point within the page I would like it to do a refresh.

Is there a simple way to do this in a jsp?
0
Lico_w
Asked:
Lico_w
3 Solutions
 
Siva Kumar AkuratiCommented:
Hello Lico_w,

If you using JSP then use the scriptlet "response.setIntHeader("Refresh", 5);"

Otherwise If you are using servlets or jsp or struts or any other framework then make it as "response.setIntHeader("Refresh", 5);" in the session or request and display in the corresponding view (jsp) page.
0
 
Lico_wAuthor Commented:
Does that have to be used in the head code? I need something that can execute in the main body after some code has ran.
0
 
jhheiderCommented:
In PHP I'd throw an:

echo "<script type='text/javascript'>document.location = '/path/to/this/page.php?a=1';</script>\n"

to force a refresh.
0
 
mrcoffee365Commented:
Lico_w:  JSP is written in Java and runs on the web server.  Javascript runs in the browser (the client).  Your questions make it sound as if you want to have some javascript execute in the browser based on some actions the user makes in the browser.  If that's the case, change the zones for the question -- you want Javascript experts, not Java experts.

If you truly mean that you have a JSP page -- which executes on the server -- then you'll have to explain what you want.  All the above answers are talking about HTML or Javascript which will make the page refresh in the user's browser.

If you want to display a page to the user with JSP, then display something different, there has to be some interaction with the server.  A JSP runs and creates HTML which is returned by the web server to the browser.  It is not running in the user's browser interactively.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now