Skip to main content

Making jMaki service arg consistent

Posted by carlavmott on June 11, 2007 at 12:57 PM PDT

We are going through the jMaki widget wrappers making sure that they all are consistent in how they support the 'service' arg. The 'service' arg is used to provide data for the widget where the data is from an external source. This means that a URL is provided to the 'service' arg.
In many samples, we specify a JSP which contains the data. This is purely for convenience as the URL can also point to a servlet or other Java EE component.

Previously the Dojo Editor wrapper used the service arg to provide a URL to a servlet which would be called on an onSave event and was expected to handle saving the contents of the editor data. While this is useful it is inconsistent with the way other widgets use the 'service' arg. In the interest of consistency and simplifying the programming model, I changed the editor wrapper so that the 'service' arg now provides data to the widget. This means that the web developer can load the editor with an existing document which can then be edited using the 'service' arg.
For example,

 <a:widget name="dojo.editor"  service="/data.jsp"/>

In this case, the contents of the editor when rendered comes from data.jsp.

But we still want to get the data from the editor for and save it. No worries. This can be done through the Glue code. See the getwidgetdata sample for an example of getting the contents of the editor. The sample also shows how to send the data back to a servlet for further processing.

Related Topics >>