p:ajax not putting javascript in onchange for inputtext

UI Components for JSF
Post Reply
jwatters1981
Posts: 7
Joined: 09 Dec 2010, 23:54

28 Sep 2011, 10:31

Server is Jboss6 final
JSF is 2.0.4-b09
primefaces is 2.2.1

I'm having trouble with the p:ajax, the f:ajax works ok

The xhtml page code is below

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.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"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body >
        <h:form id="form">
            <h:inputText id="input" value="1">
                <p:ajax event="change"/>
            </h:inputText>
        </h:form>
    </h:body>
</html>

if I view source on the page I shows

Code: Select all


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<link type="text/css" rel="stylesheet" href="/xxxx/javax.faces.resource/themes/sam/theme.css.jsf?ln=primefaces&amp;v=2.2.1" />
<script type="text/javascript" src="/XXXX/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces&v=2.2.1"></script>
<script type="text/javascript" src="/XXXX/javax.faces.resource/core/core.js.jsf?ln=primefaces&v=2.2.1"></script>
        <title>Facelet Title</title></head><body>
<form id="form" name="form" method="post" action="/XXXX/app/jsf/test.jsf" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="form" value="form" />
<input id="form:input" type="text" name="form:input" value="1" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="509032602740279760:8635497128545306060" autocomplete="off" />
</form></body>
</html>
If you look at the input field you see that javascript for the p:ajax has not been put into the onchange. It should put in something like

Code: Select all

onchange="PrimeFaces.ajax.AjaxRequest('/WebApplication1/faces/index.xhtml',{formId:'j_idt6',async:false,global:true,source:this,process:'j_idt6:j_idt7',event:'change'});"
Any help would be appreciated.

jwatters1981
Posts: 7
Joined: 09 Dec 2010, 23:54

28 Sep 2011, 13:23

Found out what was wrong. This also maybe a solution to the error Named Object: org.primefaces.component.AjaxBehavior not found.

My application was deployed as an ear file. It looks like the jboss-faces.jar file wasn't scanning the primefaces2X.jar for behaviors so at first you get the above error. I fixed it by adding the behavior to my faces-config but then the javascript wasnt rendering as stated above.

I fixed the problem by adding the jboss-faces.jar and primefaces file to my war lib directory. It fixed the problem.

Thanks

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 42 guests