Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about JSP

18 views
Skip to first unread message

Ralf Schneider

unread,
Aug 15, 2022, 8:11:37 AM8/15/22
to
Dear All,

one Question I have about JSP files: Are they old fashioned today as some
people say or is this only one opinion from many others ?

I will write web pages with Spring and I don't want to mix JSP files with
thymeleaf/html pages.

Best regards.
Ralf

e.d.pro...@gmail.com

unread,
Aug 15, 2022, 3:02:05 PM8/15/22
to
> one Question I have about JSP files: Are they old fashioned today as some
> people say or is this only one opinion from many others ?
>
Web apps tend to start with JSP files. I don't know what you mean by old fashioned; it does support a lot of syntax which is currently not recommended.
If you write clean tags with expression language (EL) and libraries (JSTL), it works fine.
If you're starting a clean new app, I think you can avoid JSP. JSP files can call other code, other code doesn't do so well calling JSP files, so maybe unavoidable working with an existing app already full of JSPs.

JSP is all back end. There's a pre-process that turns it into a .java file when the servlet gets a request for it. That Java program runs all back end code first (you can write Java code in a JSP file using scriptlets but there is a better way now). Then it kicks off any in-line Javascript code. Then it sends any html code to the front end and loads that. If you want to do back end code before the JSP loads and avoid the scriptlets, you can save the JSP file somewhere other than the default web path, catch the requests with a servlet, set pass values using EL, then forward the request to the JSP file.

It is probably best to avoid JSP files if nothing in the app is forcing the use of them. If you can write them clean, they're basically fancy HTML, but can still be harder to debug.

Ralf Schneider

unread,
Aug 16, 2022, 4:20:43 AM8/16/22
to
Am Mon, 15 Aug 2022 12:01:57 -0700 (PDT) schrieb e.d.pro...@gmail.com:

> If you're starting a clean new app, I think you can avoid JSP.

> It is probably best to avoid JSP files if nothing in the app is forcing
> the use of them.

That is what I will do. Thank you for your explanation.

Arne Vajhøj

unread,
Aug 16, 2022, 7:12:16 PM8/16/22
to
On 8/12/2022 1:10 PM, Ralf Schneider wrote:
> one Question I have about JSP files: Are they old fashioned today as some
> people say or is this only one opinion from many others ?
>
> I will write web pages with Spring and I don't want to mix JSP files with
> thymeleaf/html pages.

JSP is an old technology. But it is also a somewhat foundational
technology for Java web development. I will claim that all Java
web developers should know JSP.

So you should definitely learn JSP. Whether you should use JSP
for a project will depend on the framework choice.

DIY framework: I would say go for JSP - it is simple and easy.

JSF: definitely facelet - JSP is officially obsolete and lots
of JSF stuff does not work with JSP.

Spring MVC: different people have different preferences - some
like JSP - some like Thymeleaf - you pick what you like (or
you pick what has already been chose if it is an existing
application).

Arne

0 new messages