aspose file tools*
The moose likes JSF and the fly likes Why does JSF creates scripts tags with the attribute 'defer' without my consent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Why does JSF creates scripts tags with the attribute Watch "Why does JSF creates scripts tags with the attribute New topic
Author

Why does JSF creates scripts tags with the attribute 'defer' without my consent?

Marcos Silvestri
Ranch Hand

Joined: Dec 06, 2009
Posts: 62

For the ones unfamiliar with the attribute defer, it's something that is said to be first introduced in Internet Explorer 4, as a means to defer the execution of scripts, allowing them run after the only page has been parsed, then creating the JavaScript objects. The aim is to improve performance when carrying out requests.

For more information on it, one available web site to check is: http://hacks.mozilla.org/2009/06/defer/

The following web site explains, as according to Bugzilla, how the order of deferred scripts take place: http://www.websiteoptimization.com/speed/tweak/defer/

1) All non-deferred scripts in order of occurrence
2) Deferred inline scripts in order of occurrence
3) Deferred external scripts in order of occurrence

Now getting to the problem we have here, we constantly get these scripts errors on Internet Explorer:

----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
Timestamp: Fri, 9 Sep 2011 13:50:04 UTC


Message: 'Richfaces' is undefined
Line: 51
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: Object expected
Line: 91
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'ModalPanel' is undefined
Line: 95
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'Richfaces' is undefined
Line: 122
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'Richfaces' is undefined
Line: 142
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'ModalPanel' is undefined
Line: 146
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'Richfaces' is undefined
Line: 173
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'Richfaces' is undefined
Line: 193
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: Object expected
Line: 212
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'ModalPanel' is undefined
Line: 216
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'Richfaces' is undefined
Line: 239
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'Richfaces' is undefined
Line: 276
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'Richfaces' is undefined
Line: 291
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: Object expected
Line: 354
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'ModalPanel' is undefined
Line: 358
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'A4J' is undefined
Line: 386
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'RichFaces' is undefined
Line: 394
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'RichFaces' is undefined
Line: 394
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'RichFaces' is undefined
Line: 394
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'RichFaces' is undefined
Line: 398
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'RichFaces' is undefined
Line: 400
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'RichFaces' is undefined
Line: 406
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'RichFaces' is undefined
Line: 408
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: Object expected
Line: 451
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'ModalPanel' is undefined
Line: 501
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/


Message: 'jQuery' is undefined
Line: 33
Char: 1
Code: 0
URI: http://192.168.1.24:8085/WJPlataforma/js/jquery.maskMoney.js

----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------

I am here wondering if Richfaces does need the presence of some JavaScript objects, and when it does not find it before the page is fully parsed, we get errors such as "Object expected".

Most users of our application naturally use Internet Explorer, and we are coming across undesired navigation behaviors such as commandButtons that do not respond to events. Their listeners are fully executed, what can be checked via debugging, but the page ignores the click. We have been unfortunate that there's no error at all at the IDE Console, nor in the Tomcat Server logs. It does look like a problem totally related to the view technology in place, whether a browser issue or a flaw/misconfiguration on the Richfaces/JSF part of the equation.

One guy has run across a quite similar problem at this link: (http://community.jboss.org/message/553238). There, it is also implied the possibility of a known Internet Explorer 7 issue, or earlier versions. I'm testing here with IE8.

One important note is that: the errors above do not happen on Firefox, though the problem is still the same, the commandButton does not work.

The most intriguing thing is that everything was normal 2 days ago. Today, some buttons are working, but not all of them, to make matters worse. It does look like a localized problem quite hard to pinpoint, we cannot just say it is a problem of wide scope since there are buttons working normally.

Has anyone ever experienced anything similar?

Thanks in advance!


DJ aspirant, Engineering undergraduate, Tokusatsus addicted, fond of English language and Asia's, Buddhist, blogger, etc. I'll need to insert all these attributes in a Java class and manage to create methods for handling my overwhelming life
Marcos Silvestri
Ranch Hand

Joined: Dec 06, 2009
Posts: 62

Another valid question:

Is there a way to prevent the defer attribute to be generated for tests purposes?

We have already tested the use of



and all its possible values (NONE, ALL, DEFAULT), which is a way to work with scripts in the Richfaces/JSF scenario, these sets belonging to the web.xml. Nothing changes independently of of your choice of setting.

Thanks again!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why does JSF creates scripts tags with the attribute 'defer' without my consent?
 
Similar Threads
Using ajax in myfaces tomahawk.
JavaScript
Error on page
I keep getting on Javascript Error on the bottom left of IE
How to include a javaScript file inside XSLT file?