webtier@glassfish.java.net

Re: JSF2: problem executing scripts in Ajax response (bug-like)

From: <webtier_at_javadesktop.org>
Date: Tue, 09 Mar 2010 12:19:43 PST

Guys, could you, at least, tell me whether it's mandatory to put only one single child inside an [b]<update...>...</update>[/b] tag in the Ajax response.

For example, [b]jsf.js[/b] contains code like the following:


[b]Listing 1:[/b]

[code]
                var d = $(id);
                ...
                replaceNode(parserElement.firstChild, d);
                deleteNode(parserElement);
                runScripts(scripts);
[/code]


In other words, only the [b]firstChild[/b] of the [b]<update>[/b] element is taken into account when updating the page contents. Something like the following will cause problems because it contains two children and the first one is a script (!!!) but it's a real-life partial response by PrimeFaces:

[b]Listing 2:[/b]

[code]
<?xml version="1.0" encoding="utf-8"?>
<partial-response>
  <changes>
    <update id="form:inPhone">
      <![CDATA[<script type="text/javascript">PrimeFaces.onContentReady('form:inPhone', function() { jQuery(PrimeFaces.escapeClientId('form:inPhone')).mask('(999) 999-9999')});</script>
      <input id="form:inPhone" name="form:inPhone" type="text" value="(123) 456-7890" />]]>
    </update>
    ...
  </changes>
</partial-response>
[/code]

It is really important for me to know whether [b]the specification[/b] requires only a single child. And it is important for me to know what the spec says about the other children. And it is important for me to know whether the response in Listing 2 is wrong.

[b]I have to know whether PrimeFaces must be fixed or whether Mojarra must fixed.[/b] The PrimeFaces guys think that there's nothing worng with their implementation and that Mojarra must be fixed. As for me, I'm not sure which is right and which is wrong.

Could you comment on that, please?
[Message sent by forum member 'vesuvius' (vesuvius_prime_at_hotmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=390925