Saturday, 15 August 2015

java - Update current jsp page through servlet? -



java - Update current jsp page through servlet? -

as part of web project in college, i'm going code webshop.

i have java servlet add together items basket. servlet can called different jsp sites have items listed. cant figure out how refresh page.

i have been googling around, , found 2 proposals;

response.setheader("refresh", "1");

or

response.sendredirect("/demo.jsp")

i can't utilize solution 2, because dont know item have redirect to, called several jsp sites, , want remain on same page.

and understand solution 1, isn't 1 time refresh, script maintain updating site one-second intervals.

so can help me: how can refresh site once, when item added basket?

if want refresh page can phone call reload function

example

<input type="button" value="reload page" onclick="document.location.reload(true)">

code courtesy http://www.quackit.com/javascript/javascript_refresh_page.cfm

java jsp servlets

No comments:

Post a Comment