Are custom JSP tags accessed by multiple thread

Viewed 270

I have simple Custom JSP tag defined something like:

public class SimpleTag extends TagSupport {
    private static final long serialVersionUID = 1L;

    private String var;
    private Map<String, String> data = new HashMap<String, String>();

    public String getVar() {
        return var;
    }

    public void setVar(String var) {
        this.var = var;
    }

    @Override
    public int doStartTag() throws JspException {
        populateData();
        pageContext.setAttribute(var, data);
        return EVAL_BODY_INCLUDE;
    }

    @Override
    public int doEndTag() throws JspException {
        pageContext.setAttribute(var, null);
        return EVAL_PAGE;
    }

    private void populateData() {
        // add data to "data" map
    }
}

I expose the hashmap to the tag body.

Will the tag be reused by the container (caching/pooling) or accessed by multiple threads? Do I need take extra care in the tag design?

I apologize if it's too basic. I've been unsuccessful with my searches. Thanks in advance.

3 Answers
Related