Add jQuery Support to Content Server

March 27, 2009

There have been some updates to the jQuery platform recently that I want to help promote. Here is a little history (my point: development is ongoing, it is not a dead end project):

January 14th, 2009 jQuery 1.3 January 16th, 2009 jQuery UI 1.6 RC5 January 21sth, 2009 jQuery 1.3.1 February 20th, 2009 jQuery 1.3.2 March 6th, 2009 jQuery UI 1.7 March 19th, 2009 jQuery UI 1.7.1

jQuery is a very neat framework (my opinion). It allows you to easily manipulate the page, introduce effects and interact with the server. jQuery also makes it easy to extend with a rich community of plug-ins already available. A lot of other frameworks can make similar promises and even deliver on those promises, including but not limited to script.aculo.us, prototype, EXT, etc. These libraries (including jQuery) are not the answer to every problem you will ever have but they certainly provide solutions for many issues. With these kinds of tools all around should you not seriously consider using them instead of rolling your own?

You might say? That's? nice Stortz, but how does this relate to content server?? There are currently two components provided by our community of UCM blogs that grant support for a few of the previously mentioned frameworks. John Sim has a component to add EXT support at his blog. Obviously I did not want to be left out, did I? I am partial to jQuery, so I wanted a component to add jQuery support to Content Server.

Install this Sample jQuery Component and restart your Content Server service. At this point jQuery 1.3.2 and jQuery UI 1.7.1 are available (in no conflict mode, so please use "jQuery" instead of "$"). To get to the supplied jQuery/JSON playground go to the Administration menu and look for the JSON Lab menu item.

A fully patched 7.5.x and 10gR3 Content Server adds the ability to invoke services on Content Server with the IsJson=1 request variable, similar to the IsJava=1 variable. But, instead of returning HDA format data (IsJava=1), or SOAP (IsSoap=1) the IsJson=1 parameter and value will kick back the data in JavaScript Object Notation format (JSON).

The JSON Lab provides a venue for you to execute services, review results and script against those results. The Request tab executes services uses jQuery in the background to interact with Content Server. When the service call you executed by clicking 'Send Request' returns you are automatically flipped over to the Response tab where the JSON Data returned by Content Server is displayed and the data is also assigned to a variable named jsonData that you can utilize later in the Work Bench. Finally, the Help tab provides a little extra information.

The Request tab presents a text area in which you can enter key/value pairs for the request one to a line, kind of like a properties file. Use the Samples button to populate the request text area with prefabricated requests to learn more about what kinds of requests could be performed.

Once you click 'Send Request' jQuery kicks in some AJAX to go get the response from Content Server in JSON format. That response is plugged into a text area on the Response tab. At this time that is meant only for review. At some point I will get around to allowing editing of the response data and making those edits stick. After you have examined the response, click the Work Bench tab. Again, sample scripts are available to get you started. You can take advantage of a div below the Work Bench area with the id of 'canvas' to craft HTML from the response data.

So remember, response data is in a variable named jsonData and the div you can populate with HTML, etc., is named canvas.

Download

© 2020 Jason Stortz (version 20200607-210013)