views:

40

answers:

1

In particular I want to view the Java source code implementation for <jsp:forward>, but clicking on the tag does not bring me to a TLD, but instead to an XSD.

+4  A: 

The tags prefixed by jsp are standard actions, not tag libraries - they are not specified in a TLD. During the translation of the JSP file, the container will probably generate Java API calls. <jsp:forward page="foo" /> on Tomcat becomes:

  if (true) {
    _jspx_page_context.forward("foo");
    return;
  }

The current (JSP 2.2) reference implementation for JSPs is the Glassfish project.

McDowell
@McDowell can you say where the implementation of standard actions is in the Tomcat source? I can find the JSTL stuff but not the standard actions.
Brabster
The above code snippet comes from a temporary file in Tomcat's work directory. Jasper (Tomcat's JSP engine) translates JSPs to Java classes, then compiles them using (if memory serves) the Eclipse JDT compiler. You'll have to poke around the Jasper sources to find the code that generates the Java code.
McDowell
I see, might have a poke around later. Thanks!
Brabster
I had a suspicion that this might be servlet container specific, since it is a part of the JSP reference implementation, but I wasn't really sure. Is it fair to say that a developer would never create a standard action, but would instead create a custom tag?
hal10001
@hal10001 - I don't think there is a way to add new standard actions without modifying the JSP engine. At least, the spec doesn't mention any. You'd use custom tags as per the JEE5 tutorial: http://java.sun.com/javaee/5/docs/tutorial/doc/bnalj.html
McDowell