javax.servlet.jsp.tagext.BodyTagSupport Java Examples
The following examples show how to use
javax.servlet.jsp.tagext.BodyTagSupport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigChannelTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public int doEndTag() throws JspException { StringBuilder result = new StringBuilder(); if (nolink || id == null) { result.append(writeIcon()); result.append(name); } else { result.append("<a href=\"" + ConfigChannelTag.makeConfigChannelUrl(id) + "\">"); result.append(writeIcon()); result.append(StringEscapeUtils.escapeXml(name) + "</a>"); } JspWriter writer = pageContext.getOut(); try { writer.write(result.toString()); } catch (IOException e) { throw new JspException(e); } return BodyTagSupport.SKIP_BODY; }
Example #2
Source File: ListTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * ${@inheritDoc} */ @Override public int doAfterBody() throws JspException { int retval = BodyTagSupport.EVAL_BODY_AGAIN; ListCommand nextCmd = getNextCommand(); switch (nextCmd) { case TBL_HEADING: doAfterBodyRenderListBegin(); break; case TBL_ADDONS: doAfterBodyRenderTopAddons(); break; case COL_HEADER: doAfterBodyRenderColHeaders(); break; case BEFORE_RENDER: retval = doAfterBodyRenderBeforeData(); break; case RENDER: retval = doAfterBodyRenderData(); break; case AFTER_RENDER: retval = doAfterBodyRenderAfterData(); break; case TBL_FOOTER: retval = doAfterBodyRenderFooterAddons(); break; default: break; } return retval; }
Example #3
Source File: ListTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
private int doAfterBodyRenderBeforeData() throws JspException { ListTagUtil.write(pageContext, "</tr>"); ListTagUtil.write(pageContext, "</thead>"); ListTagUtil.setCurrentCommand(pageContext, getUniqueName(), ListCommand.BEFORE_RENDER); if (manip.isListEmpty()) { renderEmptyList(); ListTagUtil.write(pageContext, "</table>"); // close panel ListTagUtil.write(pageContext, "</div>"); // close list ListTagUtil.write(pageContext, "</div>"); return BodyTagSupport.SKIP_BODY; } ListTagUtil.write(pageContext, "<tbody>"); // render first row. The rest will be rendered in subsequent // calls to doAfterBody return doAfterBodyRenderData(); }
Example #4
Source File: ListTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * ${@inheritDoc} */ @Override public int doEndTag() throws JspException { // print the hidden fields after the list widget is printed // but before the form of the listset is closed. ListTagUtil.write(pageContext, String.format(HIDDEN_TEXT, ListTagUtil.makeParentIsAnElementLabel(getUniqueName()), parentIsElement)); // here decorators should insert other e.g hidden input fields for (ListDecorator dec : getDecorators()) { dec.afterList(); } ListTagUtil.write(pageContext, "<!-- END " + getUniqueName() + " -->"); release(); return BodyTagSupport.EVAL_PAGE; }
Example #5
Source File: ListTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
private ListDecorator getDecorator(String decName) throws JspException { if (decName != null) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { if (decName.indexOf('.') == -1) { decName = "com.redhat.rhn.frontend.taglibs.list.decorators." + decName; } ListDecorator dec = (ListDecorator) cl.loadClass(decName) .newInstance(); ListSetTag parent = (ListSetTag) BodyTagSupport .findAncestorWithClass(this, ListSetTag.class); dec.setEnvironment(pageContext, parent, getUniqueName()); return dec; } catch (Exception e) { String msg = "Exception while adding Decorator [" + decName + "]"; throw new JspException(msg, e); } } return null; }
Example #6
Source File: ColumnTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * ${@inheritDoc} */ public int doEndTag() throws JspException { if (sortable && attributeName == null && sortAttribute == null) { throw new JspException("Sortable columns must use either attr or sortAttr"); } checkForBoundsAndAttrs(); ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); if (command.equals(ListCommand.RENDER)) { ListTagUtil.write(pageContext, "</td>"); } else if (command.equals(ListCommand.ENUMERATE) && !StringUtils.isBlank(filterAttr)) { setupColumnFilter(); } return BodyTagSupport.EVAL_PAGE; }
Example #7
Source File: SelectableColumnTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
private String getIgnorableParentIds() { ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); if (!parent.isParentAnElement()) { StringBuilder buf = new StringBuilder(); for (Object current : parent.getPageData()) { if (RhnListTagFunctions.isExpandable(current)) { if (buf.length() > 0) { buf.append(","); } buf.append("'"); buf.append(makeCheckboxId(listName, ListTagHelper.getObjectId(current))); buf.append("'"); } } buf.insert(0, "["); buf.append("]"); return buf.toString(); } return "[]"; }
Example #8
Source File: ConfigChannelTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public int doEndTag() throws JspException { StringBuilder result = new StringBuilder(); if (nolink || id == null) { result.append(writeIcon()); result.append(name); } else { result.append("<a href=\"" + ConfigChannelTag.makeConfigChannelUrl(id) + "\">"); result.append(writeIcon()); result.append(StringEscapeUtils.escapeXml(name) + "</a>"); } JspWriter writer = pageContext.getOut(); try { writer.write(result.toString()); } catch (IOException e) { throw new JspException(e); } return BodyTagSupport.SKIP_BODY; }
Example #9
Source File: SelectableColumnTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
private void renderHiddenItem(String listId, String value) throws JspException { ListTagUtil.write(pageContext, "<input type=\"hidden\" "); ListTagUtil.write(pageContext, "id=\""); ListTagUtil.write(pageContext, "list_items_" + listName + "_" + listId); String pageItems = ListTagUtil.makePageItemsName(listName); ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); if (!parent.isParentAnElement() && RhnListTagFunctions.isExpandable(getCurrent())) { pageItems = "parent_" + pageItems; } ListTagUtil.write(pageContext, "\" name=\"" + pageItems + "\" "); ListTagUtil.write(pageContext, "value=\""); ListTagUtil.write(pageContext, value); ListTagUtil.write(pageContext, "\" />\n"); }
Example #10
Source File: SelectableColumnTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public int doStartTag() throws JspException { ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); listName = parent.getUniqueName(); int retval = BodyTagSupport.SKIP_BODY; setupRhnSet(); if (command.equals(ListCommand.ENUMERATE)) { parent.addColumn(); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.COL_HEADER)) { renderHeader(parent); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.RENDER)) { renderCheckbox(); } return retval; }
Example #11
Source File: RadioColumnTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public int doStartTag() throws JspException { ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); listName = parent.getUniqueName(); int retval = BodyTagSupport.SKIP_BODY; if (command.equals(ListCommand.ENUMERATE)) { parent.addColumn(); renderHiddenField(); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.COL_HEADER)) { renderHeader(parent); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.RENDER)) { render(valueExpr); } return retval; }
Example #12
Source File: SelectableColumnTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * renders * //onclick="checkbox_clicked(this, '$rhnSet')" * */ private String getOnClickScript(String funcName, String boxName) { Object current = getCurrent(); Object parent = getParentObject(); String childIds = "[]"; String memberIds = "[]"; String parentId = ""; ListTag parentTag = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); if (RhnListTagFunctions.isExpandable(current)) { childIds = getChildIds(current); } else { parentId = getParentId(current, parent); memberIds = getMemberIds(current, parent); } return String.format(CHECKBOX_CLICKED_SCRIPT, funcName, boxName, rhnSet, makeSelectAllCheckboxId(listName), childIds, memberIds, parentId, parentTag.isParentAnElement()); }
Example #13
Source File: SelectableColumnTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public int doStartTag() throws JspException { ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); listName = parent.getUniqueName(); int retval = BodyTagSupport.SKIP_BODY; setupRhnSet(); if (command.equals(ListCommand.ENUMERATE)) { parent.addColumn(); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.COL_HEADER)) { renderHeader(parent); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.RENDER)) { renderCheckbox(); } return retval; }
Example #14
Source File: SelectableColumnTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
private String getIgnorableParentIds() { ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); if (!parent.isParentAnElement()) { StringBuilder buf = new StringBuilder(); for (Object current : parent.getPageData()) { if (RhnListTagFunctions.isExpandable(current)) { if (buf.length() > 0) { buf.append(","); } buf.append("'"); buf.append(makeCheckboxId(listName, ListTagHelper.getObjectId(current))); buf.append("'"); } } buf.insert(0, "["); buf.append("]"); return buf.toString(); } return "[]"; }
Example #15
Source File: ListTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
private ListDecorator getDecorator(String decName) throws JspException { if (decName != null) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { if (decName.indexOf('.') == -1) { decName = "com.redhat.rhn.frontend.taglibs.list.decorators." + decName; } ListDecorator dec = (ListDecorator) cl.loadClass(decName) .newInstance(); ListSetTag parent = (ListSetTag) BodyTagSupport .findAncestorWithClass(this, ListSetTag.class); dec.setEnvironment(pageContext, parent, getUniqueName()); return dec; } catch (Exception e) { String msg = "Exception while adding Decorator [" + decName + "]"; throw new JspException(msg, e); } } return null; }
Example #16
Source File: ListTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * ${@inheritDoc} */ @Override public int doEndTag() throws JspException { // print the hidden fields after the list widget is printed // but before the form of the listset is closed. ListTagUtil.write(pageContext, String.format(HIDDEN_TEXT, ListTagUtil.makeParentIsAnElementLabel(getUniqueName()), parentIsElement)); // here decorators should insert other e.g hidden input fields for (ListDecorator dec : getDecorators()) { dec.afterList(); } ListTagUtil.write(pageContext, "<!-- END " + getUniqueName() + " -->"); release(); return BodyTagSupport.EVAL_PAGE; }
Example #17
Source File: ListTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
private int doAfterBodyRenderBeforeData() throws JspException { ListTagUtil.write(pageContext, "</tr>"); ListTagUtil.write(pageContext, "</thead>"); ListTagUtil.setCurrentCommand(pageContext, getUniqueName(), ListCommand.BEFORE_RENDER); if (manip.isListEmpty()) { renderEmptyList(); ListTagUtil.write(pageContext, "</table>"); // close panel ListTagUtil.write(pageContext, "</div>"); // close list ListTagUtil.write(pageContext, "</div>"); return BodyTagSupport.SKIP_BODY; } ListTagUtil.write(pageContext, "<tbody>"); // render first row. The rest will be rendered in subsequent // calls to doAfterBody return doAfterBodyRenderData(); }
Example #18
Source File: HasPermissionTag.java From kisso with Apache License 2.0 | 6 votes |
@Override public int doStartTag() throws JspException { // 在标签开始处出发该方法 HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); SSOToken token = SSOHelper.getSSOToken(request); // 如果 token 或者 name 为空 if (token != null && this.getName() != null && !"".equals(this.getName().trim())) { boolean result = SSOConfig.getInstance().getAuthorization().isPermitted(token, this.getName()); if (result) { // 权限验证通过 // 返回此则执行标签body中内容,SKIP_BODY则不执行 return BodyTagSupport.EVAL_BODY_INCLUDE; } } return BodyTagSupport.SKIP_BODY; }
Example #19
Source File: SelectableColumnTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
private void renderHiddenItem(String listId, String value) throws JspException { ListTagUtil.write(pageContext, "<input type=\"hidden\" "); ListTagUtil.write(pageContext, "id=\""); ListTagUtil.write(pageContext, "list_items_" + listName + "_" + listId); String pageItems = ListTagUtil.makePageItemsName(listName); ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); if (!parent.isParentAnElement() && RhnListTagFunctions.isExpandable(getCurrent())) { pageItems = "parent_" + pageItems; } ListTagUtil.write(pageContext, "\" name=\"" + pageItems + "\" "); ListTagUtil.write(pageContext, "value=\""); ListTagUtil.write(pageContext, value); ListTagUtil.write(pageContext, "\" />\n"); }
Example #20
Source File: ListTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * ${@inheritDoc} */ @Override public int doAfterBody() throws JspException { int retval = BodyTagSupport.EVAL_BODY_AGAIN; ListCommand nextCmd = getNextCommand(); switch (nextCmd) { case TBL_HEADING: doAfterBodyRenderListBegin(); break; case TBL_ADDONS: doAfterBodyRenderTopAddons(); break; case COL_HEADER: doAfterBodyRenderColHeaders(); break; case BEFORE_RENDER: retval = doAfterBodyRenderBeforeData(); break; case RENDER: retval = doAfterBodyRenderData(); break; case AFTER_RENDER: retval = doAfterBodyRenderAfterData(); break; case TBL_FOOTER: retval = doAfterBodyRenderFooterAddons(); break; default: break; } return retval; }
Example #21
Source File: ColumnTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * ${@inheritDoc} */ public int doEndTag() throws JspException { if (sortable && attributeName == null && sortAttribute == null) { throw new JspException("Sortable columns must use either attr or sortAttr"); } checkForBoundsAndAttrs(); ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); if (command.equals(ListCommand.RENDER)) { ListTagUtil.write(pageContext, "</td>"); } else if (command.equals(ListCommand.ENUMERATE) && !StringUtils.isBlank(filterAttr)) { setupColumnFilter(); } return BodyTagSupport.EVAL_PAGE; }
Example #22
Source File: AuthTag.java From HongsCORE with MIT License | 6 votes |
@Override public int doStartTag() throws JspException { try { NaviMap nav = NaviMap.getInstance(this.cnf); this.ebb = (this.act == null || nav.chkAuth(this.act)) && (this.rol == null || nav.chkRole(this.rol)) && (this.men == null || nav.chkRole(this.men)); } catch ( HongsException ex) { throw new JspException(ex); } if (this.not) { this.ebb = !this.ebb; } if (this.ebb) { return BodyTagSupport.EVAL_BODY_BUFFERED; } else { return BodyTagSupport.SKIP_BODY; } }
Example #23
Source File: RadioColumnTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public int doStartTag() throws JspException { ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); listName = parent.getUniqueName(); int retval = BodyTagSupport.SKIP_BODY; if (command.equals(ListCommand.ENUMERATE)) { parent.addColumn(); renderHiddenField(); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.COL_HEADER)) { renderHeader(parent); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.RENDER)) { render(valueExpr); } return retval; }
Example #24
Source File: ColumnTag.java From spacewalk with GNU General Public License v2.0 | 5 votes |
/** * ${@inheritDoc} */ public int doStartTag() throws JspException { ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class); int retval = BodyTagSupport.SKIP_BODY; currentSortDir = fetchSortDir(); if (command.equals(ListCommand.ENUMERATE)) { parent.addColumn(); retval = BodyTagSupport.EVAL_PAGE; if (isSortable()) { parent.setSortable(true); } } else if (command.equals(ListCommand.COL_HEADER)) { renderHeader(); retval = BodyTagSupport.EVAL_PAGE; } else if (command.equals(ListCommand.RENDER)) { if (isBound) { renderBound(); retval = BodyTagSupport.SKIP_BODY; } else { renderUnbound(); retval = BodyTagSupport.EVAL_BODY_INCLUDE; } } return retval; }
Example #25
Source File: SelectableColumnTag.java From spacewalk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public int doEndTag() throws JspException { ListCommand command = ListTagUtil. getCurrentCommand(this, pageContext); if (command.equals(ListCommand.RENDER)) { ListTagUtil.write(pageContext, "</td>"); } release(); return BodyTagSupport.EVAL_PAGE; }
Example #26
Source File: ListTag.java From spacewalk with GNU General Public License v2.0 | 5 votes |
private int doAfterBodyRenderData() throws JspException { // if there was a previous object, close its row if (currentObject != null) { ListTagUtil.write(pageContext, "</tr>"); } ListTagUtil.setCurrentCommand(pageContext, getUniqueName(), ListCommand.RENDER); if (iterator.hasNext()) { Object obj = iterator.next(); if (RhnListTagFunctions.isExpandable(obj)) { parentObject = obj; } currentObject = obj; } else { currentObject = null; } if (currentObject != null) { ListTagUtil.write(pageContext, "<tr"); renderRowClassAndId(); ListTagUtil.write(pageContext, ">"); pageContext.setAttribute(rowName, currentObject); } else { return doAfterBodyRenderAfterData(); } return BodyTagSupport.EVAL_BODY_AGAIN; }
Example #27
Source File: ListTagUtil.java From spacewalk with GNU General Public License v2.0 | 5 votes |
/** * Locates the current ListCommand * @param caller tag calling the method * @param ctx caller's page context * @return ListCommand if found, otherwise null */ public static ListCommand getCurrentCommand(Tag caller, PageContext ctx) { ListTag parent = null; if (!(caller instanceof ListTag)) { parent = (ListTag) BodyTagSupport.findAncestorWithClass(caller, ListTag.class); } else { parent = (ListTag) caller; } if (parent != null) { return (ListCommand) ctx.getAttribute(parent.getUniqueName() + "_cmd"); } return null; }
Example #28
Source File: RadioColumnTag.java From spacewalk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public int doEndTag() throws JspException { ListCommand command = ListTagUtil. getCurrentCommand(this, pageContext); if (command.equals(ListCommand.RENDER)) { ListTagUtil.write(pageContext, "</td>"); } release(); return BodyTagSupport.EVAL_PAGE; }
Example #29
Source File: ConfigFileTag.java From spacewalk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public int doEndTag() throws JspException { StringBuilder result = new StringBuilder(); if (nolink || id == null) { result.append(writeIcon()); result.append(StringEscapeUtils.escapeXml(path)); } else { String url; if (revisionId != null) { url = makeConfigFileRevisionUrl(id, revisionId); } else { url = makeConfigFileUrl(id); } result.append("<a href=\"" + url + "\">"); result.append(writeIcon()); result.append(StringEscapeUtils.escapeXml(path) + "</a>"); } JspWriter writer = pageContext.getOut(); try { writer.write(result.toString()); } catch (IOException e) { throw new JspException(e); } return BodyTagSupport.SKIP_BODY; }
Example #30
Source File: CSVTag.java From spacewalk with GNU General Public License v2.0 | 5 votes |
/** * ${@inheritDoc} */ @Override public int doStartTag() throws JspException { verifyEnvironment(); return BodyTagSupport.EVAL_BODY_INCLUDE; }