Jim Driscoll's Blog

Notes on Technology and the Web

Inline Scripts with Mojarra

leave a comment »

A few weeks ago, I blogged about ways to execute scripts on the client which you were writing out from the server via Ajax.  By popular demand, the latest build of Mojarra now allows execution of inline scripts.

So, instead of having to either bundle code into an <eval> tag, or using an event to execute it later, you can now simply say something like:

<script type="text/javascript">alert("Hello there");</script>

right inside the rendered html.

You can also say something like:

<script type="text/javascript" src="file.js"></script>

And the script will be loaded as well.

This feature will (probably) be the next revision of the specification, but you should be able to use this feature without fear of compatability issues going forward – the specifcation’s Expert Group has already expressed their approval of including this.

(This article originally published on my java.net blog on September 2, 2009.)

Advertisements

Written by jamesgdriscoll

February 9, 2010 at 10:05 PM

Posted in ajax, JSF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: