First of all, I should explain what is the JSP technology and how JSP pages work.The JSP technology is an open, freely available specification developed by Sun Microsystems as an alternative to Microsoft’s Active Server Pages (ASP) technology, and a key component of the Java 2 Enterprise Edition (J2EE) specification. Many of the commercially available application servers support JSP technology.

How Do JSP Pages Work?
A JSP page is basically a web page with traditional HTML and bits of Java code. The file extension of a JSP page is .jsp rather than .html or .htm, which tells the server that this page requires special handling that will be accomplished by a server extension or a plug-in.
When a JSP page is called, it will be compiled (by the JSP engine) into a Java servlet. At this point the servlet is handled by the servlet engine, just like any other servlet. The servlet engine then loads the servlet class (using a class loader) and executes it to create dynamic HTML to be sent to the browser, as shown in next figure. The servlet creates any necessary object, and writes any object as a string to an output stream to the browser.

The next time the page is requested, the JSP engine executes the already-loaded servlet unless the JSP page has changed, in which case it is automatically recompiled into a servlet and executed.
In order to do good practices you should follow these advices:
- Don’t overuse Java code in HTML pages
- Don’t mix business logic with presentation
- Use custom tags
- Do not reinvent the wheel
- Use the JSTL Expression Language
- Use filters if necessary
- Use a portable security model
- Use a database for persistent information
- Cache content
- Use connection pooling
- Cache results of database queries
- Adopt the new JSP XML syntax if necessary
Example:
<%@ page language="java" contentType="text/html" %>
<html>
<body>
<jsp:useBean id="clock" class="java.util.Date" />
The current time at the server is:
<ul>
<li>Date: <jsp:getProperty name="clock" property="date" />
<li>Month: <jsp:getProperty name="clock" property="month" />
<li>Year: <jsp:getProperty name="clock" property="year" />
<li>Hours: <jsp:getProperty name="clock" property="hours" />
<li>Minutes: <jsp:getProperty name="clock" property="minutes" />
</ul>
</body>
</html>





Estic per aki mirant a veure que tens…jiijij
Un saludo crack