Hi, I am running into a problem where if I specify a <script> to load a JavaScript file (demo-lib.js) at the top of the JSP file, the default Trinidad skin is no longer loaded by the browser: <?xml version="1.0" encoding="iso-8859-1"?> <jsp:root xmlns:jsp="http://java.sun.co m/JSP/Page" version="1.2" xmlns:f="http://java.sun.co m/jsf/core" xmlns:h="http://java.sun.co m/jsf/html" xmlns:trh="http:// myfaces.apache.org/trinidad/html" xmlns:tr="http://m yfaces.apache.org/trinidad"> <jsp:directive.page contentType="text/html;charset=utf-8" /> <link rel="stylesheet" charset="UTF-8" type="text/css" href="resources/styles/html/demo-styles-1.css"/> ; <link rel="stylesheet" charset="UTF-8" type="text/css" href="resources/styles/html/demo-styles-2.css"/> ; <!-- Include the javascript used in the demo --> <script type="text/javascript" src="script/demo-lib.js"></script> <f:view> <!-- Localization --> <f:loadBundle basename="SampleMessages" var="messages" /> <tr:document title="#{messages.titleSample}"> <h:form id="form"> ... If I move the <script> to the bottom of the file it works properly (the skins are properly loaded). But I need to specify the script at the top, as throughout my JSP there are references to the JS code that need to be declared before it is referenced, otherwise I get JS errors and the page does not load. Looking at Firebug, I see that the link to the CSS file that is typically there for the default skin, is no longer there: <link href="/demo/adf/styles/cache/monitoring-desktop-3840690 03-en-gecko-cmp.c ss;jsessionid=2BDA494AC5FC80F2057BDFFF3AE86864" type="text/css" charset="UTF-8" rel="stylesheet"/> Is there some limitation/bug on adding <script>s at the top of the JSP file? I have looked at the Skinning issues in Jira but did not find anything that matches... Any help appreciated... Thanks in advance, Cleo PS: Environment: - IE 6 and FF 2 - Trinidad 1.2.2 - TOMCAT 6
This is not valid in IE, if I remember right: <script type="text/javascript" src="script/demo-lib.js"></script> IE requires something to be between the start tag and the end tag. Try this instead: <script type="text/javascript" src="script/demo-lib.js"> </script> Since you are using trinidad, shouldn't you be using the tr:loadScript component instead? On 9/21/07, Cleo Barretto <cbarrettoilog.com> wrote: > Hi, > > I am running into a problem where if I specify a <script> to load a > JavaScript file (demo-lib.js) at the top of the JSP file, the default > Trinidad skin is no longer loaded by the browser: > > <?xml version="1.0" encoding="iso-8859-1"?> > <jsp:root xmlns:jsp="http://java.sun.co m/JSP/Page" version="1.2" > xmlns:f="http://java.sun.co m/jsf/core" > xmlns:h="http://java.sun.co m/jsf/html" > xmlns:trh="http:// myfaces.apache.org/trinidad/html" > xmlns:tr="http://m yfaces.apache.org/trinidad"> > > <jsp:directive.page contentType="text/html;charset=utf-8" /> > > <link rel="stylesheet" charset="UTF-8" type="text/css" > href="resources/styles/html/demo-styles-1.css"/> ; > <link rel="stylesheet" charset="UTF-8" type="text/css" > href="resources/styles/html/demo-styles-2.css"/> ; > > <!-- Include the javascript used in the demo --> > <script type="text/javascript" src="script/demo-lib.js"></script> > > <f:view> > > <!-- Localization --> > <f:loadBundle basename="SampleMessages" var="messages" /> > > <tr:document title="#{messages.titleSample}"> > > <h:form id="form"> > ... > > If I move the <script> to the bottom of the file it works properly (the > skins are properly loaded). But I need to specify the script at the top, > as throughout my JSP there are references to the JS code that need to be > declared before it is referenced, otherwise I get JS errors and the page > does not load. > > Looking at Firebug, I see that the link to the CSS file that is > typically there for the default skin, is no longer there: > <link > href="/demo/adf/styles/cache/monitoring-desktop-3840690 03-en-gecko-cmp.c > ss;jsessionid=2BDA494AC5FC80F2057BDFFF3AE86864" type="text/css" > charset="UTF-8" rel="stylesheet"/> > > Is there some limitation/bug on adding <script>s at the top of the JSP > file? > > I have looked at the Skinning issues in Jira but did not find anything > that matches... > > Any help appreciated... > > Thanks in advance, > Cleo > > PS: Environment: > - IE 6 and FF 2 > - Trinidad 1.2.2 > - TOMCAT 6 >
Hi Andrew, Like a charm... > This is not valid in IE, if I remember right: > <script type="text/javascript" src="script/demo-lib.js"></script> It has been working for me for along time now, so I guess I have been lucky... > Since you are using trinidad, shouldn't you be using the > tr:loadScript component instead? I was not aware of this component. Thanks for pointing it out. It works great now. Cheers, Cleo > -----Original Message----- > From: Andrew Robinson [mailto:andrew.rw.robinsongmail.com] > Sent: Friday, September 21, 2007 1:21 PM > To: MyFaces Discussion > Subject: Re: [Trinidad] Default skin not loaded when > specifying <script> at the top of JSP > > This is not valid in IE, if I remember right: > <script type="text/javascript" src="script/demo-lib.js"></script> > > IE requires something to be between the start tag and the end > tag. Try this instead: > > <script type="text/javascript" src="script/demo-lib.js"> </script> > > Since you are using trinidad, shouldn't you be using the > tr:loadScript component instead? > > On 9/21/07, Cleo Barretto <cbarrettoilog.com> wrote: > > Hi, > > > > I am running into a problem where if I specify a <script> to load a > > JavaScript file (demo-lib.js) at the top of the JSP file, > the default > > Trinidad skin is no longer loaded by the browser: > > > > <?xml version="1.0" encoding="iso-8859-1"?> <jsp:root > > xmlns:jsp="http://java.sun.co m/JSP/Page" version="1.2" > > xmlns:f="http://java.sun.co m/jsf/core" > > xmlns:h="http://java.sun.co m/jsf/html" > > xmlns:trh="http:// myfaces.apache.org/trinidad/html" > > xmlns:tr="http://m yfaces.apache.org/trinidad"> > > > > <jsp:directive.page contentType="text/html;charset=utf-8" /> > > > > <link rel="stylesheet" charset="UTF-8" type="text/css" > > href="resources/styles/html/demo-styles-1.css"/> ; > > <link rel="stylesheet" charset="UTF-8" type="text/css" > > href="resources/styles/html/demo-styles-2.css"/> ; > > > > <!-- Include the javascript used in the demo --> > > <script type="text/javascript" src="script/demo-lib.js"></script> > > > > <f:view> > > > > <!-- Localization --> > > <f:loadBundle basename="SampleMessages" var="messages" /> > > > > <tr:document title="#{messages.titleSample}"> > > > > <h:form id="form"> > > ... > > > > If I move the <script> to the bottom of the file it works properly > > (the skins are properly loaded). But I need to specify the > script at > > the top, as throughout my JSP there are references to the > JS code that > > need to be declared before it is referenced, otherwise I > get JS errors > > and the page does not load. > > > > Looking at Firebug, I see that the link to the CSS file that is > > typically there for the default skin, is no longer there: > > <link > > > href="/demo/adf/styles/cache/monitoring-desktop-3840690 03-en-gecko-cmp > > .c ss;jsessionid=2BDA494AC5FC80F2057BDFFF3AE86864" type="text/css" > > charset="UTF-8" rel="stylesheet"/> > > > > Is there some limitation/bug on adding <script>s at the top > of the JSP > > file? > > > > I have looked at the Skinning issues in Jira but did not > find anything > > that matches... > > > > Any help appreciated... > > > > Thanks in advance, > > Cleo > > > > PS: Environment: > > - IE 6 and FF 2 > > - Trinidad 1.2.2 > > - TOMCAT 6 > > >
about | contact Other archives ( Real Estate discussion Medical topics )
Mailing lists
Newsgroups
RFC archive