[jsr-314-open] h:outputScript doesn't work inside composite components

Kito Mann kito.mann at VIRTUA.COM
Mon May 11 11:29:14 EDT 2009


David, you may want to file this as a feature request for 2.0 maintenance or
2.1. It should be possible to associate a resource request with a particular
view id and component.

On Mon, May 11, 2009 at 10:54 AM, Ryan Lubke <Ryan.Lubke at sun.com> wrote:

> On 5/11/09 7:40 AM, David Geary wrote:
>
>> I have a login composite component that looks like this:
>>
>> <composite:interface>...</composite:interface>
>> ...
>> <composite:implementation>
>> <script type="text/javascript">
>>                function checkForm(form) {
>>                  var name = form['#{cc.clientId}:name'].value;
>>                  var pwd = form['#{cc.clientId}:password'].value;
>>
>>                  if (name == "" || pwd == "") {
>>                    alert("Please enter name and password.");
>>                    return false;
>>                  }
>>                  return true;
>>                }
>> </script>
>>  ...
>> </composite:implementation>
>>
>> I have components with "name" and "password" component ids in a form in
>> the ... part of the implementation. That works fine.
>>
>> However, if I pull the JS out into its own file, and do this:
>>
>> <composite:interface>...</composite:interface>
>> ...
>> <composite:implementation>
>> <h:outputScript library="components/login" name="login.js"/>
>>  ...
>> </composite:implementation>
>>
>> h:outputScript puts the JS in the page, but the JS no longer works because
>> the expression cc.clientId evaluates to an empty string.
>>
>> That's a bug, is it not?
>>
> No, I don't believe it is.  The javascript file will be served in a
> separate request.  There is no way to determine the
> component at that time.
>
> I haven't tried it, but I wonder if the flash could be used here?
>
>>
>>
>> david
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsr-314-open-mirror/attachments/20090511/58caed55/attachment.html 


More information about the jsr-314-open-mirror mailing list