throws PAPIException {
MarinerPageContext pageContext
= ContextInternals.getMarinerPageContext(context);
XFImplicitAttributes attributes = (XFImplicitAttributes) papiAttributes;
// Create a new protocol attributes object every time, as this element
// could be reused before the attributes have actually been finished with
// by the protocol.
com.volantis.mcs.protocols.XFImplicitAttributes pattributes
= new com.volantis.mcs.protocols.XFImplicitAttributes();
// Get the enclosing form element's attributes.
XFFormElementImpl formElement
= (XFFormElementImpl) pageContext.getCurrentElement();
XFFormAttributes formAttributes = formElement.getProtocolAttributes();
// Get the enclosing form element's descriptor.
FormDescriptor formDescriptor = formElement.getFormDescriptor();
// Add a reference back to the form attributes.
pattributes.setFormAttributes(formAttributes);
pattributes.setFormData(formAttributes.getFormData());
// Set the name.
String name = attributes.getName();
pattributes.setName(name);
// Set the value.
String value = attributes.getValue();
pattributes.setValue(value);
PolicyReferenceResolver resolver =
pageContext.getPolicyReferenceResolver();
// Set the client variable name
TextAssetReference reference = resolver.resolveQuotedTextExpression(
attributes.getClientVariableName());
String clientVariableName = getPlainText(reference);
// One of value and clientVariableName must be specified.
if (value == null && clientVariableName == null) {
throw new PAPIException(exceptionLocalizer.format(