当前位置: 首页>>代码示例>>Java>>正文


Java SimpleTagSupport类代码示例

本文整理汇总了Java中javax.servlet.jsp.tagext.SimpleTagSupport的典型用法代码示例。如果您正苦于以下问题:Java SimpleTagSupport类的具体用法?Java SimpleTagSupport怎么用?Java SimpleTagSupport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleTagSupport类属于javax.servlet.jsp.tagext包,在下文中一共展示了SimpleTagSupport类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
/**
 * {@link ParameterAware}を探して、コールバックします。
 * まず、直接の親タグが{@link ParameterAware}かどうか判定します。
 * そうであれば、コールバックして終了します。
 * もし、直接の親タグが{@link ParameterAware}ない場合、
 * {@link SimpleTagSupport#findAncestorWithClass(JspTag, Class)}を利用して、
 * ルートまで{@link ParameterAware}を探して辿ります。
 * それでも見つからない場合、処理を終了します。
 * @throws JspException {@link JspException}
 * @throws IOException {@link IOException}
 */
@Override
public void doTag() throws JspException, IOException {
    super.doTag();
    Args.checkNotEmpty(getName());
    JspTag s = getParent();
    if (!ParameterAware.class.isInstance(s)) {
        s = SimpleTagSupport.findAncestorWithClass(this, ParameterAware.class);
    }
    if (s == null) return;
    ParameterAware parent = (ParameterAware) s;
    if (getValues() != null) {
        parent.awareParameter(name, getValues());
    } else {
        parent.awareParameter(name, getValue());
    }

}
 
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:29,代码来源:NestedParameterTag.java

示例2: doTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
@Override
public void doTag() throws JspException, IOException
{
  JspTag tag = SimpleTagSupport.findAncestorWithClass(this, PaginationTagSupport.class);
  
  if(tag != null)
  {
    Page page = ((PaginationTagSupport) tag).getCurrent();
    
    if(!page.getLeftGap() && !page.getRightGap())
    {
      // Print out a text marker which will replaced with the appropriate page number
      // when the pagination data structure is processed
      this.getJspContext().getOut().print(Pagination.PAGE_MARKER);
    }
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:18,代码来源:PageTagSupport.java

示例3: testEventTagOutsideBuilderTagBase_WithInvalidParent_WithBody

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
public void testEventTagOutsideBuilderTagBase_WithInvalidParent_WithBody() throws Exception
{
    final EventTag tag = new EventTag();
    final PrintCharJspFragment body = new PrintCharJspFragment('-');
    tag.setJspBody(body);
    final StringJspWriter out = new StringJspWriter();
    tag.setJspContext(new MockJspContext(out));
    
    tag.setParent(new SimpleTagSupport());
    
    tag.setName("someEvent");
    
    try {
        tag.doTag();
        fail();
    }
    catch (JspException ex) {
        assertEquals("EventTag must be enclosed directly or indirectly by a BuilderTagBase tag.", ex.getMessage());
    }
    
    assertEquals("", out.getOutput());
}
 
开发者ID:dzidzitop,项目名称:jaj_taglib,代码行数:23,代码来源:EventTag_InvalidUseTest.java

示例4: testEventTagOutsideBuilderTagBase_WithInvalidParent_WithEmptyBody

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
public void testEventTagOutsideBuilderTagBase_WithInvalidParent_WithEmptyBody() throws Exception
{
    final EventTag tag = new EventTag();
    final PrintCharJspFragment body = new PrintCharJspFragment('-');
    tag.setJspBody(body);
    final StringJspWriter out = new StringJspWriter();
    tag.setJspContext(new MockJspContext(out));
    
    tag.setParent(new SimpleTagSupport());
    
    tag.setName("someEvent");
    
    try {
        tag.doTag();
        fail();
    }
    catch (JspException ex) {
        assertEquals("EventTag must be enclosed directly or indirectly by a BuilderTagBase tag.", ex.getMessage());
    }
    
    assertEquals("", out.getOutput());
}
 
开发者ID:dzidzitop,项目名称:jaj_taglib,代码行数:23,代码来源:EventTag_InvalidUseTest.java

示例5: doTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
@Override
public void doTag() throws JspException, IOException
{
  JspTag parent = SimpleTagSupport.findAncestorWithClass(this, GroupTagSupport.class);
  JspWriter out = this.getJspContext().getOut();

  if (parent != null)
  {
    GroupTagSupport group = (GroupTagSupport) parent;
    String name = group.getParam();
    String type = group.getType();

    JspTag component = findAncestorWithClass(this, ComponentMarkerIF.class);

    // If the combo box is used in the context of a component then
    // the generated parameter name needs to prefix the name of the component
    if (component != null)
    {
      name = ( (ComponentMarkerIF) component ).getParam() + "." + name;
    }

    MutableDTO current = group.getItem();
    String valueAttribute = group.getValueAttribute();
    
    this.addAttribute("type", type);
    this.addAttribute("name", name);
    this.addAttribute("value", current.getValue(valueAttribute));

    this.openTag("input", out);
    
    if (this.getJspBody() != null)
    {
      this.getJspBody().invoke(null);
    }

    this.closeTag("input", out);
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:39,代码来源:GroupOptionTagSupport.java

示例6: doTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
@Override
public void doTag() throws JspException, IOException
{
  JspTag parent = SimpleTagSupport.findAncestorWithClass(this, MessagesTagSupport.class);
  JspWriter out = this.getJspContext().getOut();

  if (parent != null)
  {
    MessagesTagSupport messages = (MessagesTagSupport) parent;
    NotificationDTOIF current = messages.getCurrent();

    out.println(current.getMessage());
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:15,代码来源:MessageTagSupport.java

示例7: doTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
@Override
public void doTag() throws JspException, IOException
{
  JspTag parent = SimpleTagSupport.findAncestorWithClass(this, SelectTagSupport.class);
  JspWriter out = this.getJspContext().getOut();

  if (parent != null)
  {
    SelectTagSupport select = (SelectTagSupport) parent;

    // Get the current item in the select collection
    ComponentDTO current = select.getCurrent();

    // Get the name of the attribute on which the value is determined
    String valueAttribute = select.getValueAttribute();

    // set selected=selected if the current value matches the value stored in
    // the DTO
    if (select.getSelectedValues().contains("|" + current.getValue(valueAttribute) + "|"))
    {
      this.setSelected("selected");
    }

    // Write the value of the option
    this.addAttribute("value", current.getValue(valueAttribute));

    this.openTag("option", out);

    if (this.getJspBody() != null)
    {
      this.getJspBody().invoke(null);
    }

    this.closeTag("option", out);
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:37,代码来源:OptionTagSupport.java

示例8: doTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
@Override
public void doTag() throws JspException, IOException
{
  JspTag parent = SimpleTagSupport.findAncestorWithClass(this, TableTagSupport.class);

  if (parent != null)
  {
    TableTagSupport tag = (TableTagSupport) parent;
    Table table = (Table) tag.getColumnar();

    // Generate a new Pagination data-structure using the supplied query object
    Pagination pagination = new Pagination(tag.getQuery(), isAsynchronous());
    
    // Loop over all of the pages in the pagination
    while (pagination.hasNext())
    {
      // Update the current Page to generate
      current = pagination.next();

      if (var != null)
      {
        this.getJspContext().setAttribute(var, current);
      }

      // Generate the pre HTML, marker, and post HTML for the current page
      if (this.getJspBody() != null)
      {
        this.getJspBody().invoke(current.getWriter());
      }
    }

    // Add the pagination structure to the table
    table.setPagination(pagination);
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:36,代码来源:PaginationTagSupport.java

示例9: doTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
@Override
public void doTag() throws JspException, IOException
{
   JspTag parent = SimpleTagSupport.findAncestorWithClass(this, LinkTagIF.class);
   
   if(parent != null)
   {
     ((LinkTagIF) parent).addProperty(name, value);
   }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:11,代码来源:PropertyTagSupport.java

示例10: testBuildGrid_EventsWithIndirectBuilderParentTag

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
/**
 * Tests that event tag's parents are scanned deeply to find a BuilderTagBase parent.
 */
public void testBuildGrid_EventsWithIndirectBuilderParentTag() throws Exception
{
    final EventTag rowStartTag = initEvent("rowStart", '^');
    final EventTag rowEndTag = initEvent("rowEnd", '$');
    
    final SimpleTag cellTagParent = new SimpleTagSupport()
    {
        @Override
        public void doTag() throws IOException, JspException
        {
            getJspBody().invoke(getJspContext().getOut());
        }
    };
    cellTagParent.setJspContext(ctx);
    cellTagParent.setParent(gridTag);
    final EventTag cellTag = initEvent(cellTagParent, "cell", '-');
    cellTagParent.setJspBody(new CallTagsJspFragment(cellTag));
    
    final CallTagsJspFragment body = new CallTagsJspFragment("foo", rowStartTag, rowEndTag, cellTagParent);
    gridTag.setJspBody(body);
    
    gridTag.rowCount = 3;
    gridTag.columnCount = 2;
    
    gridTag.doTag();
    
    assertTrue(gridTag.buildInvoked);
    assertTrue(body.invoked);
    assertEquals("^--$^--$^--$", out.getOutput());
}
 
开发者ID:dzidzitop,项目名称:jaj_taglib,代码行数:34,代码来源:BuilderTagBase_BoundaryCasesTest.java

示例11: findAncestor

import javax.servlet.jsp.tagext.SimpleTagSupport; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected <T> T findAncestor(Class<? extends BaseTag> clazz) {
	return (T) SimpleTagSupport.findAncestorWithClass(this, clazz);
}
 
开发者ID:Mrdigs,项目名称:Bootstrap.jsp,代码行数:5,代码来源:NestedTagSupport.java


注:本文中的javax.servlet.jsp.tagext.SimpleTagSupport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。