0
Good afternoon people! I have this method in Servlet that returns a list of values. How do I load the values it has, with jquery?
@WebServlet({"/ControleMovEstoque","/template/buscaMaterialExist.html","/template/cadEntradaEstq.html"})
public class ControleMovEstoque extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void verificaExistencia(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
String codigo = request.getParameter("codigo");
String query = "select M from MovimentacaoEstoque M where M.codigo = " + codigo;
List<MovimentacaoEstoque> listamovestoque = new MovimentacaoDao().existCadastrado(query);
if (new MovimentacaoDao().existCadastrado(query).isEmpty()){
request.setAttribute("modalEntrada", "<Strong>Este produto não está cadastrado no estoque</strong>");
}
else{
request.setAttribute("modalEntrada", listamovestoque);
}
}catch(Exception e){
e.printStackTrace();
}
I have a Modal window that already pays some values with html jquery:
<td><a href="entradaMateriais"
class="btn btn-xs btn-info entradaMateriais"
data-toggle="modal" data-id="${list.id_material }" >Entrada</a> </td>
The jquery:
$(".entradaMateriais").on('click', function(){
var id = $(this).data('id'); $("#fid").val(id);
var nome = $('#nome' + id).text(); $("#fnome").val(nome);
var codigo = $('#codigo' + id).text(); $("#fcodigo").val(codigo);
var categoria = $('#categoria' + id).text(); $("#fcategoria").val(categoria);
$("#entradaMateriais").modal();
});
On the screen below, I can already load what I have in html, only missing the information, marked in red, I want to take from Servlet.
Thanks for the help :)