• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Embedding Javascript in a JSF File

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am embedding a Javascript code segment within a JSF File,



But anytime i take a look at the html generated i only see


Without its content. How do i resolve this issue?
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're still using the old JSF 1.1, you should wrap template text in <f:verbatim>.
 
Saloon Keeper
Posts: 28747
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, this is a better way to do it:



Since you're embedding text that can potentially contain XML magic characters in an XML document. Which XML won't like. And even if you don't offend, any tool you used to pretty up the XML would chew up the JavaScript code formatting unless you wrapped it with a CDATA.

However, there are a couple of other problems here.

First of all, that's not how you'd attach javascript to a control, so it still won't work.

Secondly, onpaste() is not a standard JavaScript event. It works in IE and it works in Safari, but it does not work in Firefox and probably doesn't work in Opera.

So if you expected to set up a website that was trying to sell me something, you'd fail. I don't use IE for anything where money or sensitive data are involved.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic