-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Rony,

On 10/10/19 08:16, Rony G. Flatscher (Apache) wrote:
> Hi Chris,
>
>> On 10/9/19 07:08, Rony G. Flatscher (Apache) wrote:
>>> On 08.10.2019 21:16, André Warnier (tomcat) wrote:
>>>> On 08.10.2019 17:11, Rony G. Flatscher (Apache) wrote:
>>>>> Does anyone know of any tutorials that would demonstrate
>>>>> how to use any javax.script language in JSPs instead of
>>>>> Java (e.g. using Jython or JavaScript instead)?
>
> ... cut ...
>
>> My own (particularly uninformed) opinion is that most scripting
>> languages that have wanted to get into JVMs/app servers have
>> simply built their own technologies to handle everything, so it
>> doesn't run through JSP itself.
>>
>> For example, Lucee[1] is a CFML implementation in Java, but it
>> doesn't (always) use JSP. They have a separate "interpreter" for
>> it instead of building huge tag libraries to fit it into JSP. (I
>> say "interpreted" because I don't know if they actually interpret
>> the files each time on demand, or if there is a compilation step
>> at some point. It doesn't really matter either way.)
>>
>> I haven't looked at it in depth, but I believe this is also what
>> Apache JGroovy[2] does.
>>
>> -chris
>>
>> [1] https://lucee.org/ [2] https://groovy-lang.org/
>
> 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>

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/.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl2g7NEACgkQHPApP6U8
pFgNGA/8CFNKcfIOzf52FC2Nu0/LfC0TQ36+mSazkLloMkqXCBhI85yKXw55Mz94
fdLXFqN1mX0ZXnUgAXmer3MPBBdNceENjv8AjkhHKqXFUOTboXbg2/2XpYguddne
itM5XKHqhq4k8uG9wXnrgAOhrNTAOtaRKOaq4Lg9USinhdfVUrn+3OCyn8+eydzs
k096HMao/Li221y9vAoc+1iJPM3qWthgQA6GTrvdWIsqBiP0WOTT0XO6ifzDf5SX
0UmfYr7E6m5vAFBG0vieqjgA9U6OgOX59Dzc3a0XSF7ifWdmQbMntU6Rbaw7yIPb
gBdChMZeVIE89IlM3WY8jBcEjlK0FZVGjcEnPbCIQ8xdJscFpeK4Pn5vlCiXtWwM
2RcioHKSRu9OKpWN+uz7WqvNIwkbMyd1S+AKbqJxd2k2UN5yn2bKNc6SKIW4hJ9w
Srz1UE2yR/rAXlvNgtZy6gJSOE7mh+YtsrrawIUGXUOazOKkwTip6dve7xVLhLEm
RVgMlu4YOK6rMzDL8kydaNNKSw8csCuNyEpFjhwW+aKvUY3qhziRcGEF25rtkRaw
6WcnAl2sMPqcZJKLxzOQezgkzfPfJsUWMIYihtec65lV7XtKQJvCSOLLXBU272aa
yCp158Mqlkukt7Yi3kxHgCuCFaeYdi9JZrsdguAhyyOV8OISy+w=
=6QJV
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to