List of usage examples for javax.servlet.jsp PageContext setAttribute
abstract public void setAttribute(String name, Object value);
From source file:ru.runa.wf.web.customtag.impl.AbstractAutoCompletionComboBoxVarTag.java
private void displayComboboxScript(Script script, PageContext pageContext) { if (pageContext != null && pageContext.getAttribute(COMBOBOX_SCRIPT_RENDERED_ATTRIBUTE_NAME) == null) { script.addElement(/* w ww .j av a2 s .c om*/ "function handleKeyUp(selectName,actorList,codeList) {\n inputElement = document.forms[" + formName + "].elements[selectName+'" + inputNameSuffix + "'];\n selectElement = document.forms[" + formName + "].elements[selectName];\n strText = '^'+inputElement.value;\n var numShown = 0;\n re = new RegExp(strText,'gi');\n selectElement.length = 0;\n for(i = 0; i < actorList.length; i++) {\n if(actorList[i].search(re) != -1) {\n selectElement[numShown] = new Option(actorList[i], codeList[i]);\n numShown++;\n }\n }\n }\n"); script.addElement("function handleSelectClick(selectName) {\n selectElement = document.forms[" + formName + "].elements[selectName];\n selectedValue = selectElement.options[selectElement.selectedIndex].text;\n selectedValue = selectedValue.replace(/_/g, '-') ; }\n"); // script.addElement("function initpage() { inputElement = document.forms[" // + formName + "]." + inputNameSuffix + // "; handleKeyUp(); inputElement.focus(); }\n"); pageContext.setAttribute(COMBOBOX_SCRIPT_RENDERED_ATTRIBUTE_NAME, Boolean.TRUE); } }