⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 forumtag.java

📁 这是学习Java必须读懂两套源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }

    // Set the date and time of last visit to this forum
    if( trackVisits ) {
      js.setNextForumVisitDate(pageContext,cf.getID());
    }

    // Save the script variable so JSP author can access forum data
    pageContext.setAttribute(id,this,PageContext.PAGE_SCOPE);
    return EVAL_BODY_INCLUDE;
  }

  /**
   * Set a flag indicating whether date and time of users last visit
   * to this forum should be saved (Optional attribute).
   */
  public final void setTrackVisits(String a)
  {
    if( a.equals("true") )
      trackVisits=true;
  }

  /**
   * Forum ID property which can be obtained by the JSP page
   * using &lt;jsp:getProperty name=<i>"id"</i> property="forumid"/&gt;
   *
   * @return String - forum ID
   */
  public final String getForumid()
  {
    return "" + cf.getID();
  }

  /**
   * Forum Description property which can be obtained by the JSP page
   * using &lt;jsp:getProperty name=<i>"id"</i> property="description"/&gt;
   *
   * @return String - forum Description
   */
  public final String getDescription()
  {
    return cf.getDescription();
  }

  /**
   * Forum MessageCount property which can be obtained by the JSP page
   * using &lt;jsp:getProperty name=<i>"id"</i> property="messagecount"/&gt;
   *
   * @return String - forum MessageCount
   */
  public final String getMessagecount()
  {
    return "" + cf.getMessageCount();
  }

  /**
   * Forum ThreadCount property which can be obtained by the JSP page
   * using &lt;jsp:getProperty name=<i>"id"</i> property="threadcount"/&gt;
   *
   * @return String - forum ThreadCount
   */
  public final String getThreadcount()
  {
    return "" + cf.getThreadCount();
  }

  /**
   * Forum Name property which can be obtained by the JSP page
   * using &lt;jsp:getProperty name=<i>"id"</i> property="name"/&gt;
   *
   * @return String - forum Name
   */
  public final String getName()
  {
    return cf.getName();
  }

  /**
   * Date and time of Forum CreationDate (integer) property which can be
   * obtained by the JSP page using
   * &lt;jsp:getProperty name=<i>"id"</i> property="creationDate"/&gt;
   *
   * @return date and time of Forum CreationDate as an integer
   */
  public final String getCreationDate()
  {
    return "" + cf.getCreationDate().getTime();
  }

  /**
   * Date and time of Forum ModifiedDate (integer) property which can be
   * obtained by the JSP page using
   * &lt;jsp:getProperty name=<i>"id"</i> property="modifiedDate"/&gt;
   *
   * @return date and time of Forum ModifiedDate as an integer
   */
  public final String getModifiedDate()
  {
    return "" + cf.getModifiedDate().getTime();
  }

  /**
   * Date and time Forum was last visited (integer) property which can be
   * obtained by the JSP page using
   * &lt;jsp:getProperty name=<i>"id"</i> property="lastForumVisitDate"/&gt;
   *
   * @return date and time of lastForumVisitDate as an integer
   */
  public final String getLastForumVisitDate()
  {
    return "" + js.getLastForumVisitDate(cf,jr).getTime();
  }

  /**
   * Next Forum ID property which can be obtained by the JSP page
   * using &lt;jsp:getProperty name=<i>"id"</i> property="nextForumid"/&gt;
   *
   * @return String - next forum ID
   */
  public final String getNextForumid()
  {
    return "" + nextForumID;
  }

  /**
   * Previous Forum ID property which can be obtained by the JSP page
   * using &lt;jsp:getProperty name=<i>"id"</i> property="prevForumid"/&gt;
   *
   * @return String - previous forum ID
   */
  public final String getPrevForumid()
  {
    return "" + prevForumID;
  }

  /**
   * Used by ThreadLoopTag and ThreadTag to get current Forum
   *
   * @return Forum
   */
  public final Forum getForum()
  {
    return cf;
  }

  /**
   * Method used by the getYazdProperty tag to get an extended Forum
   * property from the forum tag script variable.
   *
   * @return String - value of the property
   */
  public final String getProperty(String name)
  {
    String tmp = cf.getProperty(name);
    if( tmp != null )return tmp;
    return "";
  }

  /**
   * Method used by the setYazdProperty tag to set an extended Forum
   * property from the forum tag script variable.
   */
  public final void setProperty(String name, String value)
  {
    try {
      cf.setProperty(name,value);
    } catch(UnauthorizedException ue) {
    }
  }

  /**
   * Set the <b>id</b> of a <b>match</b> tag
   */
  public final void setMatch(String mtch)
  {
    MatchTag fmt =
      (MatchTag)pageContext.getAttribute(mtch,PageContext.PAGE_SCOPE);
    if( fmt != null && fmt.getMatch() != null )
      match = fmt.getMatch();
  }

  /**
   *  Set a different forum
   */
  public final void changeForum(Forum apf)
  {
    cf = apf;
  }

  /**
   * Determine if forum has new messages since users last visit.
   *
   * @return boolean - true or false
   */
  public final boolean newMessages()
  {
    if( js.getLastForumVisitDate(cf,jr).getTime() <
        cf.getModifiedDate().getTime() )
		return true;
    return false;
  }

  /**
   * Determine if there is a forum preceding this one
   *
   * @return boolean - true or false
   */
  public final boolean prevForum()
  {
    if( prevForumID > 0 )
      return true;
    return false;
  }

  /**
   * Determine if there is a forum following this one
   *
   * @return boolean - true or false
   */
  public final boolean nextForum()
  {
    if( nextForumID > 0 )
      return true;
    return false;
  }

  /**
   * Remove the script variable after forum tag closed out
   */
  public final void release()
  {
    if( id != null && id.length() > 0 )
      pageContext.removeAttribute(id,PageContext.PAGE_SCOPE);
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -