I forgot to add the source and jsp file

package test5;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public final class ShowFieldTag extends TagSupport {

  private String field = null;
  private int start = 0;

  public ShowFieldTag() {
    init();
  }

  public void setField(String name) {
    this.field = name;
  }


  public String getField() {
    return this.field;
  }
  
  
  public int getStart() {
    return start;
  }

  public void setStart(int start) {
    this.start = start;
  }  



  public int doStartTag() throws JspException {

    if (start != 0) {
      pageContext.setAttribute("elementIndex", new Integer(start));
    }

    if (field.startsWith("show")) {
      return EVAL_BODY_INCLUDE;
    } else {
      return SKIP_BODY;
    }
  }


  public int doEndTag() throws JspException {
    return EVAL_PAGE;
  }


  public void release() {
    super.release();
    init();
  }

  private void init() {
    field = null;
    start = 0;
  }




}






<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>

<html>
<head>
<title></title>
</head>
<body>
<h1>test</h1>

<app:showField field="notshow">
        <h3>hidden</h3>
</app:showField>

<app:showField field="show">
<h3>show</h3>
        <app:showField field="notshow">
                <h3>inside</h3>
        </app:showField>
        <app:showField field="show">
                <h3>show inside</h3>
        </app:showField>        
</app:showField>



</body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to