How to use jQuery with in xhtml?

后端 未结 2 389
遇见更好的自我
遇见更好的自我 2021-01-16 17:06

i am using facelets,richfaces,and ajax, in XHTML
i am facing error while creating datepicker! What is the solution for my problem?
the code is:

相关标签:
2条回答
  • 2021-01-16 18:01

    According to http://seamframework.org/Community/HowToWriteJavaScriptInXHTML you only need to:

    <a4j:loadScript src="resource://jquery.js"/>
    
    0 讨论(0)
  • 2021-01-16 18:07

    My problem is : How to use jQuery with in xhtml?

    My Answer is: 1.Create an xhtml page using code given below.

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!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:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
          xmlns:rich="http://richfaces.ajax4jsf.org/rich">
    
        <head>
        <link type="text/css" href="css/flick/jquery-ui-1.8.5.custom.css" rel="stylesheet" />
    <a4j:loadScript src="resource:///jquery/jquery-1.4.2.min.js" />
    <a4j:loadStyle src="/jquery/jquery-ui-1.8.5.custom.css" />
    <a4j:loadScript src="resource:///jquery/jquery-ui-1.8.5.custom.min.js" />     
      </head>
      <body >      
      <h:form>
      <rich:panel>
      <h:inputText id="dp1" value="" label="test"  />
      <rich:jQuery  selector="#dp1" name="dp1" rendered="true" timing="onload" query="datepicker({chosendate:'01/05/2005',minYear:'-20Y',maxDate: '+1Y +1M',appendText: '(dd-mm-yyyy)',changeMonth:true,changeYear:true})" ></rich:jQuery>        
      </rich:panel>
      </h:form>    
     </body>    
    </html>
    

    2.then try to place JQuery.xx.js & css files below order!

    ---WebContent
    +themes
    +....
    ...jquery-1.4.2.min.js
    ...jquery-ui-1.8.5.custom.css
    ...jquery-ui-1.8.5.custom.min.js

    all these are configured in .xhtml file like above.

    3.General things we need to configure for facelets, richfaces and ajax in web.xml is common,in all the way.
    4.At last it worked Perfectly...
    Thank You Guy's..

    0 讨论(0)
提交回复
热议问题