将 JQuery 与 Richfaces 集成 [英] Integrate JQuery with Richfaces

查看:64
本文介绍了将 JQuery 与 Richfaces 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Js 世界的新手,我的 Jquery 不适用于 Richfaces.我想做这样的事情:http://jsfiddle.net/bFuEv/ .

im newbie in the world of Js , my Jquery doesn't work with richfaces. I want to do something like this : http://jsfiddle.net/bFuEv/ .

这是我的 xhtml 文件中的代码:

This is my code in my xhtml file :

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j">



    <script type="text/javascript">
        $("himessage").hide();

        $("#name").focus(function(){
         $("himessage").show();    
        });
        $("#name").blur(function(){
             $("himessage").hide();    
        });
    </script>

    <rich:panel>
        <h:form>
            <label>Name: </label>
            <h:outputText id="himessage" value="Hi" />
            <h:inputText id="name" class="editable" type="text"
                onfocus="this.value=''" name="name" value="#{loginAction.username}" />
        </h:form>
    </rich:panel>
</ui:composition>   

如何将此 jquery 代码集成到我的页面中?

How can integrate this jquery code in my page?

推荐答案

RichFaces 捆绑了 jquery.要包含库,请添加到页面(即使多次出现 - jquery.js 也只会包含一次):

RichFaces has jquery bundled with it. To include the library, add to the page (even if multiple occurrences - jquery.js will be included only once):

<h:outputScript name="jquery.js" target="head"/>

这篇关于将 JQuery 与 Richfaces 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆