Java Reference
In-Depth Information
with the required import statements, class definition statement, braces, and what-
ever else is required to create a servlet. It then compiles the servlet. If that is suc-
cessful, it then executes the servlet.
Once the servlet has been successfully compiled, the parsing and compilation
process will not occur again unless the JSP document has been changed. The servlet
engine looks at the time stamp on the JSP and the time stamp on the compiled
servlet class file to decide if it needs to recompile the JSP.
Although it is possible to design complex systems without JSPs or without
servlets, many systems are designed using both servlets and JSPs. The complex
business logic is coded as servlets. This logic doesn't change often, and you would
not want to clutter the presentation with its complexities. Once the business logic
is executed, the servlet usually stores objects in the HttpRequest or HttpSession ob-
ject and, using a RequestDispatcher , passes control to a JSP. The JSP retrieves the
object and uses its values to build the display dynamically.
Although a complete discussion of JSPs is beyond the scope of this topic, here
are a few of the other JSP tags:
Tag
Description
<%= expression %>
Evaluates the expression as a string and outputs it.
<jsp:forward>
Forwards a request to an HTML file, JSP, or servlet.
<jsp:useBean>
Instantiates or references a bean with a specific name and scope.
<jsp:getProperty>
Inserts the value of a bean property into the response.
<jsp:include>
Includes a static resource or the result from another Web component.
<jsp:setProperty>
Sets a bean property value or values.
 
Search WWH ::




Custom Search