|
Programmers Guide > JOT Views for JSP
JOT Views for JSP
JOT Views custom tags allow JSP pages to render web components with
the JOT Views rendering engine. JOT JSP tags are documented by
the WEB-INF/jotviews.tld tag library descriptor. JOT JSP tags invoke
the JOT Views rendering engine, providing access to the capabilities
of JOT Templates, JOT Web Components, and JOT Iterators.
Declaring the JOT Views custom tags on a JSP page:
<%@ taglib uri="/WEB-INF/jotviews.tld" prefix="jot" %>
JOT JSP Tags:
The ServiceRequest tag renders a response. The JotResponseBeanClass and
JOT Template (contentPath) attributes are optional (see jotviews.tld for
details):
<jot:ServiceRequest
jotResponseBeanClass="com.example.ExampleJotResponseBean"
contentPath="/webpages/ExampleJotTemplate.html" />
The RenderComponent tag uses a JOT Web Component to render
dynamic content into a JSP page. The JotContentBeanClass and JOT Template
(contentPath) attributes are optional (see jotviews.tld for details):
<jot:RenderComponent jotContentBeanClass="com.example.ExampleJotTemplateBean" />
Multiple components can share state by using the same JotServiceContext:
<%@ page import="com.jotobjects.servlet.*" %>
<% JotServiceContext ctx = JotViews.getServiceContext(pageContext); %>
. . .
<jot:RenderComponent
jotContentBeanClass = "com.example.ExampleJotTemplateBean"
jotServiceContext = "<%= ctx %>" />
Forwarding to a JOT Servlet:
JSP pages can forward requests to a JOT Servlet as the View
component in Struts or other Model-View-Controller frameworks.
The following JSP example does some processing that sets the value
of the customer property in Request scope and then forwards the
request to a JOT Servlet for response rendering.
<jsp:useBean id="customer" scope="request" class="com.example.Customer">
<% customer.setCustomerId(request.getParameter("LoginName")); %>
</jsp:useBean>
<jsp:forward page="/JotServletExampleViewRenderer"/>
|