java ee - How to change the project URL to the last servlet called? -
from servlet "servlet.html", can call servlet "servlet2.html" this:
dispatcher = getservletcontext().getrequestdispatcher("/servlet2.html"); however, in brouzer, url first servlet:
http://localhost:8080/project/servlet.html
i url of current servlet.
http://localhost:8080/project/servlet2.html
is possible?
what want perform redirect: response.sendredirect("/servlet2.html").
tl;dr;
dispatcher pass request servlet, client not see change.
when performing redirect server sending response http code 302 , parameter location full url servlet2.html. when web browser recieve kind of response perform request url given in location parameter.
here can find more explanations.
Comments
Post a Comment