【发布时间】:2015-02-05 08:10:11
【问题描述】:
您好,我是 JSF 和 jQuery 的新手。 我需要下载任何 jQuery jar 并打包到战争中才能使用吗? 因为在我的代码中我不能调用 jquery 函数。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="js/06.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#form\\:name").click(function() {
alert("hii");
});
});
</script>
</h:head>
<h:body>
<h:form id="form">
<h:outputText id="hi" value="hi guys"></h:outputText>
<input id="name" />
</h:form>
</h:body>
</html>
单击输出框时不会弹出此警报。
在我的 pom 中,我使用了这个依赖。
<dependency>
<groupId>com.efsavage.jquery</groupId>
<artifactId>jquery-maven</artifactId>
<version>1.7.2</version>
</dependency>
【问题讨论】:
标签: javascript jquery jsf jsf-2