Java .JSP Question

JC724

Weaksauce
Joined
Jan 20, 2016
Messages
118
I started a new job and I am learning a lot about Java(still fairly new to it) and web development.

We are using Spring Boot, IntelliJ, etc.

I am trying to get a much better understanding of JSP. This is the response I got from stack overflow.

JSP is a Java view technology running on the server machine which allows you to write template text in client side languages (like HTML, CSS, JavaScript, ect.). JSP supports taglibs, which are backed by pieces of Java code that let you control the page flow or output dynamically. A well-known taglib is JSTL. JSP also supports Expression Language, which can be used to access backend data (via attributes available in the page, request, session and application scopes), mostly in combination with taglibs.

I didn't complete understand this 100%.

I don't know what taglib or expression language is (what I googled wasn't every helpful)?

The reason I am even asking this is cause I was debugging some test classes errors, and once I got them to work, I wanted to test some of the output in the UI application. That is when he told me to match and track the test controller back to the implementation controller.

Which made sense and I already did that, then track the areas you were testing to the proper end points(methods), that made sense and I already had did that. Then I got confused because it tracked back to an application properties file which lead me to .jsp file with html code.

So when I was reading up on Java MVC, I learned it stands for model, view, controller.

So is the JSP the view part of "MVC" and that is normally the html webpage?

If I trace the code back to a .jsp file, does that normally mean I found the proper html page of the application that I am working on?

Will the code always trace back to a .jsp page for a web application?

I appreciate any supportive answers, good YouTube tutorials or websites where I can look this stuff up and study on my on.
 
TagLibs are like custom HTMLish looking chunks of code you can chuck in that the server side knows how to deal with. Like ASP.NET has a similar concept with their webforms using things like "<asp:Button" or "<asp:Label".

https://www.tutorialspoint.com/jsp/taglib_directive.htm
https://www.tutorialspoint.com/jsp/jsp_expression_language.htm

---
Correct, the HTML should be the 'view' part of MVC

Never delved too far into JSP, but went the Microsoft route and see them being totally analogous to ASP.NET pages.
 
Like modi123 said, it sounds a lot like MS's razor pages (.cshtml aka modern ASP .NET) which typically contains a mix of both HTML and C#.

If it is anything like that, then the file itself is considered an intermediate language, typically compiled into bytecode, and then sent through an interop on the browser-side that gets translated into DOM manipulation (the view) or bytecode (javascript) the JVM itself can understand. Typically this is done through a standard called WebAssembly.

It basically saves you the trouble of writing a ton of client-side javascript, since there are custom tags (taglibs) that get translated later on - as well as getting to use Java itself.
 
Last edited:
Check out Thymeleaf

Know that JSP isn't very popular anymore and no one is really looking for that kind of work. Get through it and move on to something else
 
Back
Top