下面列出了javax.servlet.jsp.tagext.BodyTagSupport#SKIP_BODY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* {@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;
}
/**
* {@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;
}
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();
}
/**
* {@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;
}
@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;
}
}
@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;
}
/**
* {@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;
}
/**
* {@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;
}
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();
}
/**
* {@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;
}
/**
* {@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;
}
/**
* ${@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;
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;
}
private void loopTag(TagSupport tag, JSPTreeNodeIF curNode)
throws JspException, IOException {
// loop as long as tag says so
int token;
do {
runTag(tag, curNode);
token = tag.doAfterBody();
} while (token == BodyTagSupport.EVAL_BODY_AGAIN);
if (token != BodyTagSupport.SKIP_BODY)
throw new OntopiaRuntimeException("Internal error: unknown doAfterBody token: " + token);
}
/**
* {@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;
}
/**
* ${@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;
}