package com.llgc; import java.io.IOException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.TagSupport; @SuppressWarnings ("serial") public class TagPerso extends TagSupport { private String attribute1; private String attribute2; public String getAttribute1 () { return attribute1; } public void setAttribute1 (String attribute1) { this.attribute1 = attribute1; } public String getAttribute2 () { return attribute2; } public void setAttribute2 (String attribute2) { this.attribute2 = attribute2; } @Override public int doEndTag () throws JspException { try { JspWriter out = pageContext.getOut (); out.println ("."); } catch (IOException e) { e.printStackTrace (); throw new JspException (e); } return EVAL_PAGE; } @Override public int doStartTag () throws JspException { JspWriter out = pageContext.getOut (); try { out.println ("Bonjour, les attributs valent " + attribute1 + " et " + attribute2 + ".
"); out.println ("Le corps du message : "); } catch (IOException e) { e.printStackTrace (); throw new JspException (e); } return EVAL_BODY_INCLUDE; } }