Olá, Pessoal!
Decidi recentemente, começar a estudar JSP e pesquisando encontrei uma apostila que por sinal é muito boa da que é da Caelum.
Mas travei no exercício 8.4 que é
Exercícios: criando nossa própria tag para calendário
eis meu código:
adiciona-contato.jsp
> <%@taglib uri=“http://java.sun.com/jstl/core” prefix=“c”%>
<%@taglib tagdir="/WEB-INF/tags/" prefix="caelum" %> . <html> <head> <title>Adiciona contato</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/jquery-ui.css" rel="stylesheet" /> <script src="js/jquery-1.8.2.js"></script> <script src="js/jquery-ui.js"></script> </head> <body> <c:import url="cabecalho.jsp" /> <form action="adicionaContato" method="POST"> Nome: <input type="text" name="nome" /><br /> E-mail: <input type="text" name="email" /><br /> Endereço: <input type="text" name="endereco" /><br /> Data Nascimento: <input id="dataNascimento" type="text"/><br /> <input type="submit" value="Gravar" /> </form> <c:import url="rodape.jsp" /> </body> </html>
WEB-INF/tagas/campoData.tag
<%@attribute name="id" required="true" %>
<input id="${id}" name="${id}" type="text"/>
<script type="text/javascript">
$( function() {
$("#{id}").datepicker({dateFormat: 'dd/mm/yy'});
} );
</script>
cabecalho.jsp
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<img src='<c:url value="img/img.png" />' height="100"/>
<h2>Agenda de Contatos do (a) Carlos Bruno</h2>
<hr />
rodape.jsp
<hr/>
Copyright 2011 - Todos os Direitos Reservados
</body>
</html>
Mas no console do chrome dá o seguinte erro:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
VM125:62 GET http://nikkomsgchannel/e?001e0050002900260033004a00670052002e00590058002500…360054004e0032006300200056004a005c007b0056005f0029005a00590028002c002a0055
desse Jeito funciona normalmente, mas com a taglib tagfile nao
<c:import url="cabecalho.jsp" />
<form action="adicionaContato" method="POST">
Nome: <input type="text" name="nome" /><br />
E-mail: <input type="text" name="email" /><br />
Endereço: <input type="text" name="endereco" /><br />
Data Nascimento: <input id="dataNascimento" type="text"/><br />
<input type="submit" value="Gravar" />
</form>
<c:import url="rodape.jsp" />
<script>
$( function() {
$("#dataNascimento").datepicker({dateFormat: 'dd/mm/yy'});
} );
</script>
Conto a ajuda de vocês