You can simply redirect the request server so as not to require the client to execute the second request:
request.getRequestDispatcher("SearchEmployee.jsp").forward(request, response);
Or, alternatively, you can send an HTTP redirect response, so the client should handle the redirect to the second request automatically:
response.sendRedirect(response.encodeRedirectUrl("SearchEmployee.jsp"));
, , JavaScript, , SearchEmployee.jsp
. , XML text/xml
, jQuery XML DOM success
:
success:function(msg) {
if (msg instanceof XMLDocument) {
} else {
alert(msg);
window.location.reload(true);
}
}
HTML, , , HTML. , HTML <ul>
:
success:function(msg) {
if (msg.startsWith("<ul>")) {
} else {
alert(msg);
window.location.reload(true);
}
}
, , , - .
if(msg!="")
success
, true
, ( ).
, , content-type
, , JSON :
response.setContentType("application/json");
response.getWriter().write(jobj.toString());
, jQuery , JSON success
. , , jQuery, :
success:function(msg){
if (typeof msg === "object") {
$.ajax({
url: msg.url,
});
} else {
alert(msg);
window.location.reload(true);
}
}