public class FirstTag implements Tag, Serializable {
private PageContext pc = null;
private Tag parent = null;
private String name = null;
public void setPageContext(PageContext p) {
pc = p;
}
public void setParent(Tag t) {
parent = t;
}
public Tag getParent() {
return parent;
}
public void setName(String s) {
name = s;
}
public String getName() {
return name;
}
public int doStartTag() throws JspException {
try {
if(name != null) {
pc.getOut().write("Hello " + name + "!");
} else {
pc.getOut().write("You didn't enter your name");
pc.getOut().write(", what are you afraid of ?");
}