I read about JSP in a book many years ago, and recently decided to learn on my own. I now know how to use JSP scriptlets, expressions, and declarations
<%! String str = "Hello World" %>
<%= str.length() %>
<% str=str.substring(0,5) %>
But I have read in many places (on this site and elsewhere) that I shouldn't use scriptlets. This is one such question: Eclipse using Classes in JSP
My questions are:
Thanks in advance for any help!
I do not use Servlets, but embed my JSP code onto an HTML page. UI designers with no knowledge of Java can easily modify my page. Basically I use JSP as a front end for displaying from a database and making updates to it such as when a user makes an order.
This is my personal opinion, of course. I say scriptlets are:
What to use instead?
I agree with quite a bit of what you say, but this is a terrible answer. "HTML5" isn't an answer to "how do I create dynamically-generated web pages on a server?" The answer is something like "JSTL or Thymeleaf". Maybe lead with that next time. Also, part of the question was "why not use scriptlets" which you didn't address.
Terrible? That's not consistent with "I agree with quite a bit of what you say". There are two parts: (1) What's wrong with scriptlets, and (2) What else do I use? Did you not read item #3 in the second list?