OptionTagSupport.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:Runway-SDK 作者:
@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);
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号