* @param context the Faces context.
* @param writer the response writer.
* @throws IOException when an I/O error occurs.
*/
protected void writeClientWindowField(FacesContext context, ResponseWriter writer) throws IOException {
ClientWindow window = context.getExternalContext().getClientWindow();
if (null != window) {
writer.startElement("input", null);
writer.writeAttribute("type", "hidden", null);
String clientWindowParam = ResponseStateManager.CLIENT_WINDOW_PARAM;
UIViewRoot viewRoot = context.getViewRoot();
if ((namespaceParameters) && (viewRoot instanceof NamingContainer)) {
String namingContainerId = viewRoot.getContainerClientId(context);
if (namingContainerId != null) {
clientWindowParam = namingContainerId + clientWindowParam;
}
}
writer.writeAttribute("name", clientWindowParam, null);
writer.writeAttribute("id", Util.getClientWindowId(context), null);
writer.writeAttribute("value", window.getId(), null);
if (webConfig.isOptionEnabled(AutoCompleteOffOnViewState)) {
writer.writeAttribute("autocomplete", "off", null);
}
writer.endElement("input");
}