O'Reilly logo

Mastering ServiceNow by Martin Wood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dynamically creating content with Jelly

Even if UI Pages only used HTML, UI Pages would be very powerful. However, UI Pages really come alive when the HTML is dynamically generated by using Jelly.

To see how this works, edit the hello_world UI Page again. Remove the HTML tag that renders the input field:

<input name="user_name" id="user_field"/>

In its place, add the following line:

<input name="user_name" id="user_field" value="${gs.getUserName()}" />

When you refresh the page, you'll see that the input field has been populated with the User ID of the currently logged-in user. This is a JEXL expression that evaluates some JavaScript. What's all this? Let's find out!

Touching on XML

Jelly must always be syntactically valid XML. HTML is a subset of XML, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required