So I have an example question as follows:
Explain how a JSP page is executed and what kind of problems may occur.
I’m fine with the first part, compile the static html and the scriptlets to java to be served by the servlet etc.
But I’m stumped by what problems may occur? The JSP page is held in memory… so maybe that may exhaust memory? I’m kinda grabbing at straws here…
One potentially problematic thing that a lot of people overlook when writing JSP pages is the fact that JSP declarations, i.e.:
create instance variables when they get compiled into servlets, which destroys the thread safety of the JSP.
More generally though, common problems include using a semicolon at the end of an expression, or not using a semicolon in a scriptlet; attempting to retrieve parameter or attribute or session values that are null or are the wrong type; using the wrong scope when trying to access variables. All sorts of fun stuff.