Closed ren-zhijun-oracle closed 15 years ago
@javaserverfaces Commented Reported by driscoll
@javaserverfaces Commented 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 @rlubke said: Marking for 2.0
@javaserverfaces Commented driscoll said: Change milestone
@javaserverfaces Commented @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 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 @manfredriem said: Closing issue out
@javaserverfaces Commented Was assigned to javaserverfowner
@javaserverfaces Commented This issue was imported from java.net JIRA JAVASERVERFACES-842
@javaserverfaces Commented Marked as cannot reproduce on Tuesday, March 31st 2009, 3:49:32 am
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]