Apparement, le tag ui:script ne sert pas à celà, il suffit d'utiliser une balise script standard (tant que tu restes en xhtml). Par contre, il faut encadrer ton code dans un tag spécial <![CDATA[
ton code ]]>
Voici un code fonctionnel:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<ui:page binding="#{Page1.page1}" id="page1">
<ui:html binding="#{Page1.html1}" id="html1">
<ui:head binding="#{Page1.head1}" id="head1">
<ui:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
<script type="text/javascript"><![CDATA[
function getName(){
userName = prompt("Please enter your name:","");
alert("Welcome to my site, " + userName);
}
]]>
</script>
</ui:head>
<ui:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
<ui:form binding="#{Page1.form1}" id="form1">
<script type="text/javascript"><![CDATA[
getName();
]]>
</script>
</ui:form>
</ui:body>
</ui:html>
</ui:page>
</f:view>
</jsp:root> |
Et voici le fil du forum creator où j'ai trouvé celà:
http://forum.sun.com/jive/thread.jsp...threadID=98786
Valère
Partager