Regarding my recent postings on the JSF file upload thread, what I've done now is to incorporate a modified version of that in my main application. But in order to make as few changes as possible to earlier code, I'm using an iframe to display the file upload page in an existing page of my application.
Servlet.service() for servletjsp threw exception org.apache.jasper.JasperException: /upload/uploadfile.jsp(26,4) PWC6131: Attribute onchange invalid for tag outputText according to TLD at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:62) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:357) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:185)...
What does "onchange invalid for tag outputText according to TLD" mean?
However, if I remove the onchange="getFilename()" in the <hutputText> tag as displayed and instead put in onklick="getFilename()" in the <h:commandButton> tag and replace:
alert(document.getElementById("jsfupload:filesaved").value); by alert(document.getElementById("jsfupload:fileup").value);
The code that works is not particularly useful, as it gives the filename together with its path before it is uploaded, whereas it would be much more useful to have just the filename after it has been successfully uploaded.
Some help from Darryl or anybody else would be most appreciated to solve this interesting problem.
I have used "onklick()" as the spelling because of the way the text is parsed.
"What does "onchange invalid for tag outputText according to TLD" mean?"
Basically <hutputText> renders as text in the html. You can't really have any onChange events on text in html. Unlike a drop down box, or input field for example. So, it's like trying to call a method on a class where that method is not defined. There is no onChange "method" defined in the tag library descriptor.
Joined: Dec 12, 2007
OK, many thanks indeed for that helpful advice, as it's saved me a lot of time. I've now altered the code to the following:
However, eventually it might be much better to update the parent page immediately after a file is successfully uploaded, but this might mean getting involved with AJAX or whatever.