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.
views:
40answers:
1
+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
2010-01-01 14:11:24
@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
2010-01-01 14:14:12
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
2010-01-01 14:21:35
I see, might have a poke around later. Thanks!
Brabster
2010-01-01 14:30:21
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
2010-01-01 14:53:11
@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
2010-01-01 15:33:17