Factsheet
Are JSP and Servlets still relevant?
Is jsp worth learning in 2024?
java - How does jsp work? - Stack Overflow
Is there any Difference between JAVA and JSP - Stack Overflow
Can JSP be used to integrate HTML with Java code?
What are JavaServer Pages (JSP) in web development?
What role do JavaBeans play in JSP?
Videos
Hi,
Currently I am considering writing a new web app. The app is simple, it computed the theoretical value of stock-options and warrants, in exchange of the user name and email.
I am quite familiar with java so I don’t want to go the NodeJS route (at least not if I can avoid it.)
I have seen Springboot tutorial but it seems a little bit bloated for my needs.
So I am considering JSP and Servlets. Could you please let me know if this tech stack is still relevant?
EDIT:Thanks everyone for your insightful feedback. It helps a lot.
For people wondering the same thing, this is a quick summary, if you don’t want to go through the comments.
-
Servlets are still relevant. Frameworks like springboot are wrapped around Servlets.
-
JSP is kind of old. It will work but you should prefer Thymeleaf or JSF (if you want to go the standard route)
-
Some other quoted framework that I am still yet to consider are Microprofile, Quarkus, Play Framework, JSF, Jakarta EE, JMustache, Mohara (which is a JSF implementation)
/!\ Whatever you do, DO NOT USE APACHE STRUTS…´
If you were in my place, would you have learn jsp and servlets? Currently I have hands on experience and learned core java, swing, javafx, Jdbc and mysql and currently learning Hibernate. My main aim is to learn spring or springboot so should I learn need to learn jsp? Also There aren't any resources on yt regarding jsp as of current scenario
Basically:
In your servlet container, the JSP servlet is mapped to any URL that ends in
.jsp(usually)When one of those
.jspURLs is requested, the request goes to the JSP servlet. Then, this servlet checks if the JSP is already compiled.If the JSP is not compiled yet, the JSP servlet translates the JSP to some Java source code implementing the
Servletinterface. Then it compiles this Java source code to a.classfile. This.classfile usually is located somewhere in the servlet container's work directory for the application.Once the JSP servlet has compiled the servlet class from the JSP source code, it just forwards the request to this servlet class.
The thing is, unless you specifically precompile your JSP, all this happens at runtime, and hidden in the servlet container's work directory, so it is "invisible". Also have in mind that this is what happens "conceptually", several optimizations are possible in this workflow.
Yes, they are compiled!
Older compilers even produced java and class files.
Looks like with newer compilers ( at least starting with Sun JDK 6 update 30 ), they can do all the byte-code generation in-memory, so you do not see any traces in your application work or temp directories.
In short,
Java is object oriented computing language which can do almost anything you want to do.
JSP is technology based on java, JSP processor generates webpages using java language.
Java is a pure object oriented language, by object oriented I mean, we create classes and instantiate objects of those classes. If you work with pure Java, simple difference you will notice is the output will be displayed on console, so we use different plugins for different kind of outputs (for eg. applets). Java is used as a core language meaning anything you write as a Java code is converted into machine level code, which can be interpreted by the processor.
Now when you say JSP, i.e. Java Server Pages, the name itself defines it. In simple terms, you embed your Java code into your HTML pages. If you are familiar with the concepts of servlets in Java, you may understand the complexities of using these servlets. JSPs on the other hand eases the work with HTML. The best example of a JSP page is that you can easily juggle your data to and from your HTML page to Java code, and one interesting fact about JSP is that it gets converted into servlets.
There are other various differences between Java and JSP but you need to be familiar with servlets to understand JSP.