I have two JSP pages: in one it checks a client link condition; if it has no link, it enters a function that calls another JSP to import the client data.
It even imports the data, but when it returns to the JSP that called it it does not bring the data soon, I have to retype the client to see its data!
I want to know if there is any way to import and return to the previous JSP, does it already fetch the data and fill in the fields automatically?
This is part of the JSP code that calls the other JSP to import data
function setar(chave, campo, valorchave, valorcampo, vinculo) {
if (vinculo == 'N'){
document.getElementById(chave).value = valorchave;
document.getElementById(campo).value = valorcampo;
x.innerHTML = "";
hide();
if(campo=="nome") {
var jsquery = "<%= query%>";
//Tira o paciente e coloca o escolhido
jsquery = replaceParameter(jsquery, "codcli", valorchave);
document.getElementById("frmcadastrar").action = displayPopup("ativapaciente.jsp?"+jsquery+ "&emp="+empresa,"ativapac",300,500);
}
}else{
document.getElementById(chave).value = valorchave;
document.getElementById(campo).value = valorcampo;
x.innerHTML = "";
hide();
if(campo=="nome") {
var jsquery = "<%= query%>";
jsquery = replaceParameter(jsquery, "codcli",valorchave);
document.getElementById("frmcadastrar").action = "detalheagenda.jsp?"+jsquery;
document.getElementById("frmcadastrar").submit();
}
}
}
and here is part of the JSP that imports the data and returns to the one you called
function gravarPacienteAtivo(){
if(document.getElementById("cpf").value != "" || document.getElementById("carteira").value != "" || document.getElementById("fone").value != "" ) {
var salvar = document.getElementById("frmcadastrar");
salvar.action+="?codcli="+cod_pac+"&cod_empresa="+empresa;
salvar.submit();
}else
alert("Escolha e preencha uma das informações necessárias.");
}
}
//função retorna a janela
function iniciar() {
if(inf == "1"){
alert("Paciente ativado com sucesso.");
//Abri a página que abriu esse jsp
self.close();
window.opener.location.reload(true);
} else
inicio();
}
}