Deprecated feature: Tag: declareService
The wcf:declareService
tag adds client-side support for
invoking a service request. The ID is used to register the specified service so it can be invoked
with the wc.service.invoke(serviceId, parameters)
function. The
parameters
parameter is an object map that is passed as parameters to the service
URL.
Instead of using the wcf:declareService
tag, write JavaScript
code.
Tag information | |
---|---|
Body Content | empty |
Display Name | Declare Service |
Tag filepath | /META-INF/tags/wcf/DeclareService.tag |
Attributes
Name | Required | Type | Description |
---|---|---|---|
id |
true |
String | The service ID. |
actionId |
true |
String | The action identifier that is used to uniquely identify the action that is performed by this service. |
url |
true |
String | The URL to process this service. |
formId |
false |
String | The element ID of the form that is to be submitted to this service. |
validateParametersScript |
false |
JSP fragment | JavaScript that validates the parameters that are being passed to this request. This script must be composed by a developer. The script uses the local variable parameters , which is the Object map of parameters that were passed to the service. The script can also update a local variable that is called valid to false to indicate that the request must be stopped. If this attribute is not specified, then the parameters are always considered to be valid. |
validateFormScript |
false |
JSP fragment | JavaScript that validates the form that is specified by the formId . This
script must be composed by a developer. The script uses the local variable formNode
, which is the form node that is extracted from the document. The script can also update a
local variable that is called valid to false to indicate
that the request must be stopped. If this attribute is not specified, then the form is always
considered to be valid. |
successTestScript |
false |
JSP fragment | JavaScript that examines the service response object to determine whether the request was
successful or not. The script uses the local variable serviceResponse , which is
the service response object. The script must also update a local variable that is called
success to false to indicate that the request was not successful.
This result determines whether the success handler or the failure handler is invoked. If this
attribute is not specified, then the service response Object is tested to see whether there is a
property that is called errorCode . If the errorCode property
exists, then the service request is treated as a failed request. |
successHandlerScript |
false |
JSP fragment | JavaScript that is run after the successful invocation of the service request. The script can
use the local variable
serviceResponse
, which is an Object that contains the service response map. |
failureHandlerScript |
false |
JSP fragment | JavaScript that is run after a failed invocation of the service request. The script can use the local variable serviceResponse , which is an Object that contains the service response map. |
Variables
No variables are defined for the
wcf:declareService
tag.
Example
The following example declares a service that is called
AjaxDeleteOrderItem
that can be used to delete an order
item.
<wcf:declareService
id="AjaxDeleteOrderItem"
actionId="AjaxDeleteOrderItem"
url="AjaxDeleteOrderItem">
</wcf:declareService>