-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Rony,
On 10/13/19 08:40, Rony G. Flatscher (Apache) wrote: > 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? I think your question *does* have an actual answer, but I'm going to put it off for one more post, because I think this is the better answer to your question: "It doesn't matter what is needed, because it's a bad idea and shouldn't be done, anyway." If you agree that better tag libraries are needed more than scripting-style code blocks, then why persist in trying to build-out technology to enable scripting-style code blocks? If I were king, I'd deprecate the "language" attribute in JSP and abolish scriptlets *entirely*, making this whole question moot. You can also resurrect the BSF-style tag library and allow any kind of scripting in there -- even mixed-language pages! -- that you want, which I also think is a bad idea. - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl2lv2wACgkQHPApP6U8 pFjH6A/+L+l/XMnnPOkXBBrHDHG6MFactMau8T/3aPefTpK+v1MuvYu5YUMpnYCb hL1zZcs3jhOn2dxTkG1oP+G4wRF1hlfNdU4GQ2hQ6PjB02qFN7Mm1kur1d//E5kK 4ARB04AuA6pGCuW7L8JUhILpZq5mVrwvGV0HSbQy7lKx2eqaBMd5AxbO6IxLtj1p gx3Zd5e+Ex70Susl7hhzUfr7AC4Vi5jk4EUYGaEYND719iPx3aU9gazomPNRVf3C fXqHNVAqochuDF7Z4tQUsY87nOAqsg5XexGtliiKbYI6hQ/vWKitEF3P/X4AER1J HneY87Snhghz2RW1n4Mou6jupMZ7kGf7dB5IQ3yHjCkVbjOPFpE+jjyV2TLSnoYU v/lkFnSWQdPDHlRtzbFsD/4zicCtkfCYK2QRCnN1A8qtOXS06ek5dhuNybam0Lbz civdG9LygwpwLkpxq3lNvTw9yOauF7LwV1yV/BvGwdD0m5HNoohveSESw6A4ZJT0 oLWiOLBq0OLuYBrtUXse+xcdmz5bMCjJ03ll8TuMF2dpowdeoK6+TrZFIEMyw6cb Et75gASS89D8s6bqK7TlLad2O6+Zb6a2adUgOQuQys7ijwUunOKOGumh3V5eRRgH t3iczwTYLFw+1NEagNzb1Dsl+TO1i4PBN5hhDp2sqeTCuCJeCdA= =GUz4 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org