javaee / mojarra

PLEASE NOTE: This project has moved to Eclipse Foundation and will be archived under the JavaEE GitHub Organization. After Feb. 1, 2021, the new location will be github.com/javaee/mojarra. Mojarra - Oracle's implementation of the JavaServer Faces specification
https://github.com/eclipse-ee4j/mojarra
Other
164 stars 58 forks source link

Value substituions don't work in the scripts of composite components #846

Closed javaserverfaces closed 15 years ago

javaserverfaces commented 15 years ago

if you place a value like this:

var savedValue = "#

{compositeComponent.attrs.value}

";

In an inline script of a composite component, it works.

If you place it in an external script, the .js file is returned to the browser as an empty file, and the following error appears in the logs:

[#|2008-11-06T09:45:33.660-0800|SEVERE|glassfish|javax.enterprise.system.container.web|_ThreadID=16;_ThreadName=Thread-3;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception java.lang.NullPointerException at com.sun.faces.el.ScopedAttributeELResolver.getValue(ScopedAttributeELResolver.java:80) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143) at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72) at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:86) at com.sun.el.parser.AstValue.getValue(AstValue.java:127) at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206) at com.sun.faces.application.resource.ResourceImpl$1.evaluateExpressionIntoBuffer(ResourceImpl.java:304) at com.sun.faces.application.resource.ResourceImpl$1.readExpressionIntoBufferAndEvaluateIntoBuffer(ResourceImpl.java:244) at com.sun.faces.application.resource.ResourceImpl$1.read(ResourceImpl.java:217) at java.io.InputStream.read(InputStream.java:173) at java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:196) at com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:260) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)

Environment

Operating System: All Platform: All

Affected Versions

[current]

javaserverfaces commented 15 years ago

Reported by driscoll

javaserverfaces commented 15 years ago

driscoll said: Steps to reproduce:

create a page which calls a composite component named "componentname".

Create a composite component with

Also, declare "value" in the interface.

In resources/componetname/componentname.js, place one line: var savedValue = "#

{compositeComponent.attrs.value}

"; (You can add more lines as well, just to see that the bug effects all lines.)

On page load, you'll see that the js file has a single, empty line. There is no error sent to the user, and the stack trace is as above in the logs.

I can post the exact code if this is still not clear.

javaserverfaces commented 15 years ago

@rlubke said: Marking for 2.0

javaserverfaces commented 15 years ago

driscoll said: Change milestone

javaserverfaces commented 15 years ago

@rlubke said: The null pointer exception no longer occurs in the trunk.

However, to set expectations, using #

{compositeComponent}

expressions in an external script won't work since external scripts will be requested separately from the page and as such there will be no current component (beit composite or otherwise)

javaserverfaces commented 15 years ago

driscoll said: As an aside, some of the ajax demos, (see jsf-demo/ajax-switchlist) show examples of one proper way to use separate scripts with the #

{compositeComponent}

EL. (Think of it as passing a context to the function.)

javaserverfaces commented 12 years ago

@manfredriem said: Closing issue out

javaserverfaces commented 15 years ago

Was assigned to javaserverfowner

javaserverfaces commented 7 years ago

This issue was imported from java.net JIRA JAVASERVERFACES-842

javaserverfaces commented 15 years ago

Marked as cannot reproduce on Tuesday, March 31st 2009, 3:49:32 am