tags:

views:

99

answers:

1

Is it possible to get the filename of the jsp file that uses a taglib from the java code?

I.e.

public int doStartTag() throws JspException 
{
 try
 {
  String xxx = pageContext.?

Where xxx would get the filename of the jsp file (which of course could be a nested include file)

br /B

+1  A: 

It's not possible to get the name of the JSP file simply because at this point it has been compiled and you're dealing with compiled version rather than source JSP file.

You can get the name of the class JSP has been compiled into via

pageContext.getPage().getClass().getName();

and try to derive the JSP name from it but the naming scheme differs between JSP containers.

ChssPly76
When you put it this way, and after examining the compiled jsp classes, I understand why.
Brimstedt