Swastik Dey is correct. If you are just starting out on JSP, it's important to use modern techniques and develop good habits right at the start.
The use of Java code in scriptlets in a JSP has been discredited since 2002 (10 years ago!
) and is no longer acceptable.
You should find a tutorial or other learning materials that emphasize the JSTL (JSP Standard Tag Library) and the EL (Expression Language).
I also recommend that JSP novices read the following articles:
The Secret Life of JSPsThe Front Man