This content has been marked as final.
Show 3 replies
-
1. Re: Use JSP script in xhtml
shane.bryzak Feb 16, 2006 12:00 AM (in response to ericmacau)It needs to be placed in a CDATA:
<script type="text/javascript"> // <![CDATA[ // Your code here // ]]> </script>
-
2. Re: Use JSP script in xhtml
gavin.king Feb 16, 2006 12:06 AM (in response to ericmacau)I think he means a JSP scriplet, not javascript.
Scriptlets are highly frowned upon. Use a JSF component. -
3. Re: Use JSP script in xhtml
hookomjj Feb 16, 2006 12:12 AM (in response to ericmacau)"ericmacau" wrote:
Hello,
How can I add some code in XHTML (under faceletes)?
There's the beanshell addition to Facelets, but it was developed a long while ago and may need some updating. But for the most part, you should avoid scripting logical behavior within the presentation layer and take a more declarative approach with your UIs.
With that said, you can do some neat things with EL/JSTL:#{myfn:staticFunction(bean.property)}
Loading Functions within your tag libraries for specialized behavior-- these can even result in booleans and used in JSTL core/control tags.#{(bean.boolProp) ? 'A' : (bean.boolProp2) ? 'B' : 'C'}
To inline chains of choice statements instead of doing if/elseif/else clauses. Much faster too btw.