Prepare the Tree for rendering.
@throws JspException if a JSP exception has occurred
15997
public void doTag()
            throws JspException, IOException
    {
        if (hasErrors()) {
            reportErrors();
            return;
        }

        // See if there is a TreeRoot already defined.
        _expr = new ExpressionHandling(this);
        TreeElement root = null;
        try {
            root = getTreeRoot(_expr);
        }
        catch (IllegalExpressionException iee) {
            String s = Bundle.getString("TreeRootError", new Object[]{_dataSource, iee.getMessage()});
            registerTagError(s, null);
            return;
        }
        if (hasErrors()) {
            reportErrors();
            return;
        }

        // If we don't have a root element, then we need to create it by processing the body which contains
        // /*<TreeItems>*/ tags that define the tree.
        if (root == null) {
            getBufferBody(false);

            // check to see if we should exit due to an error occuring
            // write out any error text and return.
            if (_errorText != null) {
                write(_errorText.toString());
                if (hasErrors())
                    reportErrors();
            }
        }

        // Set the image Root if it is not set.
        PageContext pageContext = getPageContext();
        if (_iState.getImageRoot() == null)
            _iState.setImageRoot(((HttpServletRequest) pageContext.getRequest()).getContextPath() + "/" +
                    TagConfig.getTreeImageLocation());

        //  errors should have been caught above
        TreeElement treeRoot = getTreeRoot(_expr);

        // if the tree root hasn't been defined, then we need to update the object that is
        // pointed at by the dataSource expression.
        if (treeRoot == null) {
            if (_rootNode != null) {
                try {
                    String datasource = "{" + _dataSource + "}";
                    _expr.updateExpression(datasource, _rootNode, pageContext);
                }
                catch (ExpressionUpdateException e) {
                    String s = Bundle.getString("Tags_UnableToWriteTree", new Object[]{_dataSource, e.getMessage()});
                    registerTagError(s, null);
                    reportErrors();
                    return;
                }
                treeRoot = _rootNode;
            }

            // indicate an update error and return
            if (treeRoot == null) {
                String s = Bundle.getString("Tags_TreeNoAttribute", _dataSource);
                registerTagError(s, null);
                reportErrors();
                return;
            }

        }

        // set the root image
        if (treeRoot instanceof ITreeRootElement) {
            ITreeRootElement tre = (ITreeRootElement) treeRoot;
            if (tre.getRootNodeExpandedImage() == null) {
                tre.setRootNodeExpandedImage((_rootNodeExpandedImage != null) ?
                        _rootNodeExpandedImage : InheritableState.IMAGE_ROOT_EXPANDED);
            }
            if (tre.getRootNodeCollapsedImage() == null) {
                tre.setRootNodeCollapsedImage((_rootNodeCollapsedImage != null) ?
                        _rootNodeCollapsedImage : InheritableState.IMAGE_ROOT_COLLAPSED);
            }
        }

        // if we are running the tree at the client, then
        // we need to register the tree with the NameService
        if (_trs.runAtClient) {
            // it's currently not legal to have a runAtClient but not be an instance of INameable which is
            // implemented by the ITreeRootElement.
            if (!(treeRoot instanceof INameable)) {
                String s = Bundle.getString("Tags_TreeRunAtClientRoot", null);
                registerTagError(s, null);
                reportErrors();
                return;
            }

            // name the tree if it hasn't been named already
            // or if no longer stored in the NameService, add it.
            INameable in = (INameable) treeRoot;
            String o = in.getObjectName();
            NameService ns = NameService.instance(pageContext.getSession());
            if (o == null) {
                ns.nameObject("Tree", in);
                ns.put(in);
            }
            else if (ns.get(o) == null) {
                ns.put(in);
            }
        }


        // prepare to render the tree
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
        InternalStringBuilder sb = new InternalStringBuilder(1024);
        StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb);

        // this is the treeId from the request.  If there was an tree expansion this will be
        // non-null and it identifies what tree had the expansion request.
        // we need to qualify the tree based upon the tagId
        assert(_trs.tagId != null);
        _trs.tagId = getIdForTagId(_trs.tagId);

        String treeId = request.getParameter(TreeElement.TREE_ID);
        if (treeId != null && _trs.tagId.equals(treeId)) {
            TreeHelpers.processTreeRequest(treeId, treeRoot, request, response);
        }

        // check for the nodes that are expanded...
        // Add the script support for the tree.
        if (_trs.runAtClient) {
            IScriptReporter sr = getScriptReporter();
            if (sr == null) {
                String s = Bundle.getString("Tags_TreeRunAtClientSC", null);
                registerTagError(s, null);
                reportErrors();
                return;
            }

            ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request);
            if (!srs.isFeatureWritten(CoreScriptFeature.DYNAMIC_INIT)) {
                String s = Bundle.getString("Tags_TreeHtmlRunAtClient", null);
                registerTagError(s, null);
                reportErrors();
                return;
            }

            assert(treeRoot instanceof ITreeRootElement);
            ITreeRootElement tre = (ITreeRootElement) treeRoot;

            Object[] args = new Object[8];
            args[0] = _iState.getImageRoot() + "/";
            args[1] = tre.getObjectName();
            args[2] = _iState.getNodeCollapsedImage();
            args[3] = _iState.getNodeExpandedImage();
            args[4] = _iState.getLastNodeCollapsedImage();
            args[5] = _iState.getLastNodeExpandedImage();
            args[6] = Bundle.getString("Tags_TreeAltTextExpand", null);
            args[7] = Bundle.getString("Tags_TreeAltTextCollapse", null);
            srs.writeFeature(sr, writer, CoreScriptFeature.TREE_INIT, false, false, args);

            AjaxUrlInfo ajaxInfo = URLRewriterService.getAjaxUrl(pageContext.getServletContext(),request,treeRoot);
            if (ajaxInfo.getCommandPrefix() != null) {
                args = new Object[2];
                args[0] = tre.getObjectName();
                args[1] = ajaxInfo.getCommandPrefix();
                srs.writeFeature(sr,writer, CoreScriptFeature.AJAX_PREFIX, false,false,args);
            }
            if (ajaxInfo.getAjaxParameter() != null) {
                args = new Object[2];
                args[0] = tre.getObjectName();
                args[1] = ajaxInfo.getAjaxParameter();
                srs.writeFeature(sr,writer, CoreScriptFeature.AJAX_PARAM, false,false,args);
            }

            tre.setTreeRenderState(_trs);
            tre.setInheritableState(_iState);
        }

        // create a containing tree level <div> and place the tree level styles on it.
        _divState.styleClass = _treeStyleClass;
        _divState.style = _treeStyle;
        String divId = null;
        if (_renderTagIdLookup) {
            _divState.id = _trs.tagId;
            divId = _divState.id;
        }

        // if we are running on the client then we need to output the tree name into the top level tree <div> tag
        if (_trs.runAtClient) {
            _divState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, "netui:treeName",
                    ((INameable) treeRoot).getObjectName());
        }

        TagRenderingBase divRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.DIV_TAG, request);
        divRenderer.doStartTag(writer, _divState);
        sb.append("\n");

        // Render the tree.
        AttributeRenderer extraAttrs = new AttributeRenderer();
        String treeRendererClassName = TagConfig.getTreeRendererClassName();
        TreeRenderer tr = TreeRendererFactory.getInstance(treeRendererClassName);
        if (tr == null) {
            tr = new TreeRenderer();
        }
        tr.init(_trs, request, response, pageContext.getServletContext());
        tr.setTreeRenderSupport(new TagTreeRenderSupport(this));
        tr.render(writer, treeRoot, 0, extraAttrs, _iState);
        if (hasErrors()) {
            reportErrors();
            return;
        }

        // finish the tree representation and write it
        divRenderer.doEndTag(writer);
        sb.append("\n");
        write(sb.toString());

        if (!(treeRoot instanceof ITreeRootElement)) {
            boolean error = false;
            if (_rootNodeExpandedImage != null) {
                String s = Bundle.getString("Tags_TreeRootImageError", null);
                registerTagError(s, null);
                error = true;
            }
            if (_rootNodeCollapsedImage != null) {
                String s = Bundle.getString("Tags_TreeRootImageError", null);
                registerTagError(s, null);
                error = true;
            }
            if (error) {
                reportErrors();
            }            
        }

        // check to see if we are writing out the java.
        if (_renderTagIdLookup) {
            String jsOut = renderDefaultJavaScript(request, divId);
            if (jsOut != null)
                write(jsOut);
        }
    }
496556
public int doStartTag()
            throws JspException
    {
        String scope = getRealIdScope();
        pushIdScope();

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        writeBeforeBlocks(writer);

        // if there is a scopeId, then we need to create a div to contains everything
        if (_idScope != null) {
            write("<div");
            write(" netui:idScope=\"");
            write(scope);
            write("\" ");
            write(">");
        }

        return EVAL_BODY_INCLUDE;
    }
218740
protected function loadStructure()
    {
        // Method ajaxTreeView is in TreeView.php - watch out!
        $response = new Response(
            $this->getDataContainer()->ajaxTreeView($this->getAjaxId(), (int) $this->getPost('level'))
        );

        throw new ResponseException($response);
    }
1354854
public int doEndTag() throws JspException
    {
        String scriptId = null;

        ServletRequest req = pageContext.getRequest();

        if ((hasErrors()) || _hasError) {
            localRelease();
            return EVAL_PAGE;
        }

        // the parent was validated in the doStartTag call
        Tag parentTag = getParent();
        while (!(parentTag instanceof Select)) {
            parentTag = parentTag.getParent();
        }

        assert (parentTag instanceof Select);
        Select parentSelect = (Select) parentTag;
        if (parentSelect.isRepeater()) {
            if (!isRenderable(parentSelect))
                return EVAL_PAGE;
        }


        // Generate an HTML <option> element
        //InternalStringBuilder results = new InternalStringBuilder(128);
        _state.value = _value;

        // we assume that tagId will over have override id if both
        // are defined.
        if (_state.id != null) {
            scriptId = renderNameAndId((HttpServletRequest) req, _state, null);
        }

        _state.disabled = _disabled;

        if (parentSelect.isMatched(_value))
            _state.selected = true;

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.OPTION_TAG, req);
        br.doStartTag(writer, _state);


        if (_text == null)
            write(parentSelect.formatText(_value));
        else {
            //@TODO: How should we report errors
            write(parentSelect.formatText(_text));
        }
        br.doEndTag(writer);

        parentSelect.addOptionToList(_value);

        if (scriptId != null)
            write(scriptId);

        // Continue evaluating this page
        localRelease();
        return EVAL_PAGE;
    }
1202262
public int doEndTag() throws JspException
    {
        // report errors that may have occurred when the required attributes are being set
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // build the anchor into the results
        ByRef script = new ByRef();

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        TagRenderingBase trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.AREA_TAG, request);

        if (!createAnchorBeginTag(request, script, trb, writer, REQUIRED_ATTR)) {
            if (!script.isNull())
                write(script.getRef().toString());
            return reportAndExit(EVAL_PAGE);
        }

        assert(trb != null) : "trb is null";
        trb.doEndTag(writer);

        if (!script.isNull())
            write(script.getRef().toString());

        // Render the remainder to the output stream
        localRelease();
        return EVAL_PAGE;
    }
502436
public int doEndTag() throws JspException
    {
        ServletRequest req = pageContext.getRequest();
        Object textObject = null;

        // Get the value of the data source.  The object will not be null.
        Object val = evaluateDataSource();
        textObject = (val != null) ? val : "";
        assert(textObject != null);

        // setup the rest of the state.
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        _state.disabled = isDisabled();

        // if there were expression errors report them
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // if there were format errors then report them
        if (_formatErrors) {
            if (bodyContent != null) {
                String value = bodyContent.getString().trim();
                bodyContent.clearBody();
                write(value);
            }
        }

        // create the input tag.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.TEXT_AREA_TAG, req);
        br.doStartTag(writer, _state);

        // create the text value which will be found inside the textarea.
        if ((textObject == null) || (textObject.toString().length() == 0)) {
            textObject = _defaultValue;
        }

        String text = formatText(textObject);
        if (text != null) {
            // make sure leading blank line in the text value is not interpreted
            // just as formatting... force a new line for formatting
            if (text.startsWith("\n") || text.startsWith("\r")) {
                writer.append("\n");
            }
            HtmlUtils.filter(text, writer);
        }

        //results.append(text);
        br.doEndTag(writer);

        // if there are errors report them...
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // report any script
        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
297718
public int doEndTag() throws JspException
    {
        ServletRequest req = pageContext.getRequest();

        // Create an appropriate "input" element based on our parameters
        if (_password) {
            _state.type = INPUT_PASSWORD;
        }
        else {
            _state.type = INPUT_TEXT;
        }


        // Create the state for the input tag
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        _state.disabled = isDisabled();

        // Create the text value of the TextBox
        Object textObject = evaluateDataSource();
        if ((textObject == null) || (textObject.toString().length() == 0)) {
            textObject = _defaultValue;
        }

        // Get the text value for the textbox, the result
        String text = null;
        if (textObject != null) {
            text = formatText(textObject);
            InternalStringBuilder sb = new InternalStringBuilder(text.length() + 16);
            StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb);
            HtmlUtils.filter(text, sbAppend);
            text = sb.toString();
        }
        _state.value = text;

        // if there were format errors then report them
        if (_formatErrors) {
            if (bodyContent != null) {
                String value = bodyContent.getString().trim();
                bodyContent.clearBody();
                write(value);
            }
        }

        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // create the input tag.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_TEXT_TAG, req);
        assert(br != null);

        br.doStartTag(writer, _state);
        br.doEndTag(writer);

        // write any script that needs to be written
        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
576398
public int doStartTag() throws JspException
    {
        ServletRequest req = pageContext.getRequest();
        if (_cr == null)
            _cr = TagRenderingBase.Factory.getConstantRendering(req);

        // get the evaluated dataSource and default values
        Object val = evaluateDataSource();
        _defaultSelections = (List) evaluateDefaultValue();
        if (hasErrors()) {
            return SKIP_BODY;
        }

        // process the default values and create the matching array...
        if (val != null) {
            buildMatch(val);
            if (hasErrors()) {
                return SKIP_BODY;
            }
        }

        // if the checkbox group is disabled do not write out the
        // hidden field.
        _writer = new WriteRenderAppender(pageContext);
        if (!_repeater && !_disabled) {

            //Create hidden field for state tracking
            _state.clear();
            String hiddenParamName = null;
            hiddenParamName = getQualifiedDataSourceName() + OLDVALUE_SUFFIX;
            _state.name = hiddenParamName;
            _state.value = "true";

            TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
            hiddenTag.doStartTag(_writer, _state);
            hiddenTag.doEndTag(_writer);
        }

        if (isVertical())
            _cr.TABLE(_writer);

        // if this is a repeater then we shouid prime the pump...
        _dynamicAttrs = evaluateOptionsDataSource();
        assert (_dynamicAttrs != null);
        assert (_dynamicAttrs instanceof Map ||
                _dynamicAttrs instanceof Iterator);

        if (_repeater) {
            if (_dynamicAttrs instanceof Map) {
                _dynamicAttrs = ((Map) _dynamicAttrs).entrySet().iterator();
            }
            if (!(_dynamicAttrs instanceof Iterator)) {
                String s = Bundle.getString("Tags_OptionsDSIteratorError");
                registerTagError(s, null);
                return SKIP_BODY;
            }
            while (((Iterator) _dynamicAttrs).hasNext()) {
                _repCurItem = ((Iterator) _dynamicAttrs).next();
                if (_repCurItem != null)
                    break;
            }
            if (isVertical())
                _cr.TR_TD(_writer);

            DataAccessProviderStack.addDataAccessProvider(this, pageContext);
        }
        _saveBody = new InternalStringBuilder(128);

        // Continue processing this page
        return EVAL_BODY_BUFFERED;

    }
821245
@Override
  public void prepare(ResponseBuilder rb, ComponentFields mtasFields)
      throws IOException {
    mtasFields.doStatus = true;
    String key = rb.req.getParams()
        .get(PARAM_MTAS_STATUS + "." + NAME_MTAS_STATUS_KEY, null);
    boolean getHandler = rb.req.getParams()
        .getBool(MtasSolrComponentStatus.PARAM_MTAS_STATUS + "."
            + NAME_MTAS_STATUS_MTASHANDLER, false);
    boolean getNumberOfDocuments = rb.req.getParams()
        .getBool(MtasSolrComponentStatus.PARAM_MTAS_STATUS + "."
            + NAME_MTAS_STATUS_NUMBEROFDOCUMENTS, false);
    boolean getNumberOfSegments = rb.req.getParams()
        .getBool(MtasSolrComponentStatus.PARAM_MTAS_STATUS + "."
            + NAME_MTAS_STATUS_NUMBEROFSEGMENTS, false);
    mtasFields.status = new ComponentStatus(rb.req.getCore().getName(), key,
        getHandler, getNumberOfDocuments, getNumberOfSegments);
    mtasFields.status.numberOfDocuments = rb.req.getSearcher().getRawReader()
        .numDocs();
    mtasFields.status.numberOfSegments = rb.req.getSearcher().getRawReader()
        .leaves().size();
  }
1232948
protected void initServlet(XmlParser.Node node) throws ClassNotFoundException,UnavailableException,IOException,
            MalformedURLException
    {
        String name=node.getString("servlet-name",false,true);
        String className=node.getString("servlet-class",false,true);
        String jspFile=null;
        Holder template=null;
        if(className==null)
        {
            // There is no class, so look for a jsp file
            jspFile=node.getString("jsp-file",false,true);
            if(jspFile!=null)
            {
                Map.Entry entry=getWebApplicationHandler().getHolderEntry(jspFile);
                if(entry!=null)
                {
                    template = (Holder)entry.getValue();
                    className=template.getClassName();  
                }
            }
            if(className==null)
            {
                log.warn("Missing servlet-class|jsp-file in "+node);
                return;
            }
        }
        if(name==null)
            name=className;
        ServletHolder holder=getWebApplicationHandler().newServletHolder(name,className,jspFile);

        // handle JSP configuration
        if(jspFile!=null)
        {
            Enumeration e=template.getInitParameterNames();
            
            while(e.hasMoreElements())
            {   
                String p=(String)e.nextElement();
                holder.setInitParameter(p, template.getInitParameter(p));
            }
            if (holder.getInitParameter("classpath")==null)
                holder.setInitParameter("classpath",getWebApplicationContext().getFileClassPath());
        }
       
        // handle init params
        Iterator iParamsIter=node.iterator("init-param");
        while(iParamsIter.hasNext())
        {
            XmlParser.Node paramNode=(XmlParser.Node)iParamsIter.next();
            String pname=paramNode.getString("param-name",false,true);
            String pvalue=paramNode.getString("param-value",false,true);
            holder.put(pname,pvalue);
        }
        XmlParser.Node startup=node.get("load-on-startup");
        if(startup!=null)
        {
            String s=startup.toString(false,true).toLowerCase();
            if(s.startsWith("t"))
            {
                log.warn("Deprecated boolean load-on-startup.  Please use integer");
                holder.setInitOrder(1);
            }
            else
            {
                int order=0;
                try
                {
                    if(s!=null&&s.trim().length()>0)
                        order=Integer.parseInt(s);
                }
                catch(Exception e)
                {
                    log.warn("Cannot parse load-on-startup "+s+". Please use integer");
                    LogSupport.ignore(log,e);
                }
                holder.setInitOrder(order);
            }
        }
        Iterator sRefsIter=node.iterator("security-role-ref");
        while(sRefsIter.hasNext())
        {
            XmlParser.Node securityRef=(XmlParser.Node)sRefsIter.next();
            String roleName=securityRef.getString("role-name",false,true);
            String roleLink=securityRef.getString("role-link",false,true);
            if(roleName!=null&&roleName.length()>0&&roleLink!=null&&roleLink.length()>0)
            {
                if(log.isDebugEnabled())
                    log.debug("link role "+roleName+" to "+roleLink+" for "+this);
                holder.setUserRoleLink(roleName,roleLink);
            }
            else
            {
                log.warn("Ignored invalid security-role-ref element: "+"servlet-name="+name+", "+securityRef);
            }
        }
        XmlParser.Node run_as=node.get("run-as");
        if(run_as!=null)
        {
            String roleName=run_as.getString("role-name",false,true);
            if(roleName!=null)
                holder.setRunAs(roleName);
        }
    }
436891
public int doStartTag() throws JspException
    {
        // we assume that tagId will over have override id if both are defined.
        if (_state.id != null) {
            _idScript = renderNameAndId((HttpServletRequest) pageContext.getRequest(), _state, null);
        }

        // render the header...
        _writer = new WriteRenderAppender(pageContext);
        _br = TagRenderingBase.Factory.getRendering(TagRenderingBase.BODY_TAG, pageContext.getRequest());
        _br.doStartTag(_writer, _state);

        return EVAL_BODY_INCLUDE;
    }
1165788
public void init() throws ServletException {
		ServletContext sc = this.getServletContext();
		String configList = this.getServletConfig().getInitParameter("configList");
		String[] configs = StringUtil.split(configList, ",");
		for (int i = 0; i < configs.length; i++) {
			Debug.logVerbose("[JdonFramework] locate a configuration in web.xml :" + configs[i], module);
			css.prepare(configs[i], new ServletContextWrapper(sc));
		}
	}
366563
public void doTag()
            throws JspException, IOException
    {
        String value = getBufferBody(true);
        if (value != null)
            _text = value;

        Object o = getParent();
        assert (o != null);
        if (!(o instanceof TreeItem)) {
            logger.error("Invalid Parent (expected a TreeItem):" + o.getClass().getName());
            return;
        }

        // assign the value to the parent's label value
        TreeItem ti = (TreeItem) o;
        ti.setItemContent(_text);
    }
654161
@Override
	protected void preparePaintComponent(final Request request) {
		super.preparePaintComponent(request);

		// If is an internal AJAX action, set the action type.
		if (isCurrentAjaxTrigger()) {
			AjaxOperation operation = AjaxHelper.getCurrentOperation();
			if (operation.isInternalAjaxRequest()) {
				// Want to replace children in the target (Internal defaults to REPLACE target)
				operation.setAction(AjaxOperation.AjaxAction.IN);
			}
		}
		// Check if a custom tree needs the expanded rows checked
		TreeItemIdNode custom = getCustomTree();
		if (custom != null) {
			checkExpandedCustomNodes();
		}

		// Make sure the ID maps are up to date
		clearItemIdMaps();
		if (getExpandMode() == ExpandMode.LAZY) {
			if (AjaxHelper.getCurrentOperation() == null) {
				clearPrevExpandedRows();
			} else {
				addPrevExpandedCurrent();
			}
		}
	}
50120
public int doEndTag() throws JspException
    {
        Object val = evaluateDataSource();

        ServletRequest req = pageContext.getRequest();

        if (_dataInput != null) {
            val = _dataInput.toString();
        }

        // if there were expression errors report them
        if (hasErrors())
            return reportAndExit(SKIP_BODY);

        if (val != null) {
            _value = val.toString();
        }

        // Create an appropriate "input" element based on our parameters
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        if (_value != null) {
            InternalStringBuilder sb = new InternalStringBuilder(_value.length() + 16);
            StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb);
            HtmlUtils.filter(_value, sbAppend);
            _state.value = sb.toString();
        }

        // correct for null text here
        if (_state.value == null)
            _state.value = "";

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);

        hiddenTag.doStartTag(writer, _state);
        hiddenTag.doEndTag(writer);

        if (!ref.isNull())
            write((String) ref.getRef());

        // Continue processing this page
        localRelease();
        return SKIP_BODY;
    }
1265244
protected void initTree(CmsResource rootRes) throws CmsException {

        m_currentRoot = rootRes;
        m_treeContainer.removeAllComponents();
        showHeader();
        CmsSitemapTreeController controller = new CmsSitemapTreeController(
            A_CmsUI.getCmsObject(),
            rootRes,
            this,
            m_treeContainer);

        // no need to escape a structure id
        JavaScript.eval(CmsGwtConstants.VAR_LOCALE_ROOT + "='" + rootRes.getStructureId() + "'");

        CmsSitemapUI ui = (CmsSitemapUI)(A_CmsUI.get());
        ui.getSitemapExtension().setSitemapTreeController(controller);
        CmsSitemapTreeNode root1 = controller.createRootNode();
        controller.initEventHandlers(root1);
        m_treeContainer.addComponent(root1);
        controller.onClickOpen(root1);
    }
126422
protected void init() throws JspException {

        // initialize OpenCms access objects
        m_controller = CmsFlexController.getController(pageContext.getRequest());
        m_cms = m_controller.getCmsObject();

        try {
            I_CmsSearchConfiguration config = null;
            if (m_configFile != null) {
                CmsFile configFile = m_cms.readFile(CmsJspElFunctions.convertRawResource(m_cms, m_configFile));
                if (m_fileFormat == FileFormat.JSON) {
                    // read the JSON config file
                    OpenCms.getLocaleManager();
                    String configString = new String(
                        configFile.getContents(),
                        CmsLocaleManager.getResourceEncoding(m_cms, configFile));
                    config = new CmsSearchConfiguration(new CmsJSONSearchConfigurationParser(configString));
                } else { // assume XML
                    CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(m_cms, configFile);
                    config = new CmsSearchConfiguration(
                        new CmsXMLSearchConfigurationParser(xmlContent, m_cms.getRequestContext().getLocale()));
                }
            }
            if (m_configString != null) {
                if (m_configString.trim().startsWith("{")) {
                    config = new CmsSearchConfiguration(new CmsJSONSearchConfigurationParser(m_configString, config));
                } else {
                    config = new CmsSearchConfiguration(
                        new CmsPlainQuerySearchConfigurationParser(m_configString, config));
                }
            }
            m_searchController = new CmsSearchController(config);

            String indexName = m_searchController.getCommon().getConfig().getSolrIndex();
            // try to use configured index
            if ((indexName != null) && !indexName.trim().isEmpty()) {
                m_index = OpenCms.getSearchManager().getIndexSolr(indexName);
            }
            // if not successful, use the following default
            if (m_index == null) {
                m_index = OpenCms.getSearchManager().getIndexSolr(
                    m_cms.getRequestContext().getCurrentProject().isOnlineProject()
                    ? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
                    : CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE);
            }

            storeAttribute(getVar(), getSearchResults());

        } catch (Exception e) { // CmsException | UnsupportedEncodingException | JSONException
            LOG.error(e.getLocalizedMessage(), e);
            m_controller.setThrowable(e, m_cms.getRequestContext().getUri());
            throw new JspException(e);
        }
    }