Chris: thank you for your information and reflections!
> On 10/10/19 08:16, Rony G. Flatscher (Apache) wrote: > ... cut ... > > Maybe if some standard "script" taglib library for javax.script > > languages existed like the proof-of-concept one in [1] then that > > could be exploited/(re)used rather than coming up with non-standard > > implementations of their own. > > I hesitate to say this due to your previous experience with tag > libraries, but ... a tag library is basically a JSP thing which > obviates the need to use any actual Java in the JSP file. > > (My statements here are basically already covered in the publication; > I'm re-itterating them, here for emphasis and clarification.) > > There isn't anything inherently Java-esque about any of the existing > tag libraries (e.g. JSTL), and once you have converted a page filled > with spaghetti Java code in scriptlets (e.g. <% java goes here %>) > into one that exclusively uses tag libraries, the implications of > using <%@page language="java" instead of e.g. language="jython" or > whatever kind of evaporate. > > That is, if you write a tag library, then: > > 1. Using the taglib in the JSP file isn't using Java > 2. Using the taglib in the JSP isn't using the other language, > either... instead, it's using ... taglib-lang or whatever you want to > call that > > So if you want to do this: > > <%@page > language="c" > import="<stdio.h>" > %> > <% > println("Hello, world!\n"); > %> > > Then you'd need to get a "language" binding in JSP. > > But instead, if you want to to this: > > <%@page language="doesntmatter"%> > <mytaglib:say>Hello, world!</mytaglib:say> How (where, what needs to be extended, what needs to be deployed how) would this have to be implemented to allow it to work generically in all containers for all javax.script engines? > Then you can implement the tag library using any programming language > you want, as long as you are able to register it properly with the JSP > servlet and have it respond to the calls targeted at the tag library > interface(s) you have implemented. > > IMHO, the BSF taglib is a project that deserved to die. It took all of > the horrible possibilities of Java scriptlets in JSPs and made the > language pluggable so that you could have garbage spaghetti code in > your language of choice packaged inside of a JSP. Good riddance. > > Resurrecting the capabilities of the BSF taglib is, again IMHO, a > waste of effort. That effort would be better spent creating better (or > more diverse) tag libraries that don't expose the concept of > "scriptlets" to the programmer /at all/. Concurring! :) Actually in [1], p. 58, last paragraph ( almost ten years ago) the student concluded: "While the Script Tag Library fills a gap in current Java web development technology, more work could be done on the JSP specification itself. The specification already includes the page directive facility for specifying the language of a JSP page. Now that JSR-223 is part of the core Java library, it is possible to mandate that implementing containers should support languages other than Java by using the javax.script API. While this would prevent the mixing of multiple scripting languages on one page, it is unlikely that a JSP page would be worked on by multiple developers using different scripting languages, making that ability something of an edge case." What would be the starting point, how would you advise to implement this such that any javax.script language could be used just by denoting its name? (Short of such a possibility the "scriptlet"-concept can hardly be circumvented.) Or with other words, what is needed to allow "<%@page language="rexx"%>" ("rexx" being a javax.script.Engine, could be "javascript", "jython", "php", "jacl", "jlog", ...), which might be the easiest for the script language programmers? ---rony [1] Ryabenkiy S.: "Java Web Scripting und Apache Tomcat", <http://wi.wu.ac.at/rgf/diplomarbeiten/BakkStuff/2010/201007_Ryabenkiy/201007_Ryabenkiy_WebScripting_ApacheTomCat_TagLib.pdf>.