Hi
Another solution is to add another tag to the lib, which the developer
could add at the top of the page - ala the Struts <html:script> tag. Making it parameterless so that it could itself find out which librarys to load
or
add
some more fuctionality to the view <f:tag> so that it would render the
<link> stuff.
Hermod
-----Opprinnelig melding-----Hello everybody,
Fra: Sylvain Vieujot [mailto:[EMAIL PROTECTED]
Sendt: 30. november 2004 13:47
Til: MyFaces Development
Emne: _javascript_ Hell
Right now, some components require you to include some _javascript_ libraries in your app, and to reference those libraries in your page's header.
Just for your example webapp, the header looks like that :
<!-- JSCook Menu --><script language="_javascript_" src="" type="text/_javascript_"></script> <script language="_javascript_" src=""></script> <link rel="stylesheet" href="" type="text/css"> <script language="_javascript_" src=""></script> <link rel="stylesheet" href="" type="text/css"> <script language="_javascript_" src=""></script> <link rel="stylesheet" href="" type="text/css"> <script language="_javascript_" src=""></script> <link rel="stylesheet" href="" type="text/css"> <!-- JSCalendar --> <script language="_javascript_" src="" type="text/_javascript_"></script> <link rel="stylesheet" href="" type="text/css"> <link rel="stylesheet" href="" type="text/css"> <!-- JSPopup --> <script language="_javascript_" src="" type="text/_javascript_"></script>
I'm now working on a new component that is _javascript_ intensive too, and that would require the include of at least 5 other .js files.
I think we should make this transparent to the user by :So, starting to think about a solution for this, here is my first idea :
- Including the scripts/css/whatever required in the myfaces.jar file as resources. So, we are sure we always have the .js file's version that works, and the developer just needs to include the myfaces lib. (this will grow a bite the size of the jar though).
- Have the components load the script/css/whatever in a standard way so that the page's developer doesn't need to bother, and so that the script/css/... is only included once in the page.
- Have all those scripts/css/... as resources
- Make an additional servlet that the webapp developper would include in his web.xml declarations, and that would be invoqued like :
http://my.webserver.com/webapp/myFacesRessource?name=jspopup.js
This is the only thing the webapp developper would have to do (declare the servlet), but I don't see how we could avoid that without writing the scripts/css/... into the page.- Have a facility so that the component's renderer can call something like includeRessourceScriptLibrary(facesContext,"jspopup/JSPopup.js") (similar helper for css, ...), and the code calling the above servlet is automatically included in the page.
Writing the scripts/css/... into the page would be bad for caching, and wouldn't allow us to use standard images with this facility.
Any thoughts on this ?
Sylvain.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email.
This email message has been virus checked by the virus programs used
in the DnB NOR Group.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
