DSP Loader"

From Documentation
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{ZKConfigurationReferencePageHeader}}
 
{{ZKConfigurationReferencePageHeader}}
  
 +
=InterpreterServlet=
 
  [Optional] Class: <javadoc>org.zkoss.web.servlet.dsp.InterpreterServlet</javadoc>
 
  [Optional] Class: <javadoc>org.zkoss.web.servlet.dsp.InterpreterServlet</javadoc>
  
<tt>InterpreterServlet</tt> is a servlet used to process the DSP files. DSP is a JSP-like template technology. It takes the same syntax as that of JSP. Unlike JSP, DSP is interpreted at the run time, so it is easy to deploy DSP pages. No Java compiler is required in your run-time environment. In addition, you could distribute DSP pages in jar files. This is the way ZK is distributed.
+
DSP Loader is a servlet used to process the DSP files. DSP is a JSP-like template technology.
 +
 
 +
It is optional. You need to specify it only if you have DSP pages in your Web application.
 +
 
 +
It takes the same syntax as that of JSP. Unlike JSP, DSP is interpreted at the run time, so it is easy to deploy DSP pages. No Java compiler is required in your run-time environment. In addition, you could distribute DSP pages in jar files. This is the way ZK is distributed.
  
 
However, you cannot embed Java codes in DSP pages. Actions of DSP, though extensible through TLD files, are different from JSP tags.
 
However, you cannot embed Java codes in DSP pages. Actions of DSP, though extensible through TLD files, are different from JSP tags.
  
== The Initial Parameters ==
+
= The Initial Parameters =
  
{| border="1"
+
{| class='wikitable'
 
! <center>init-param</center>
 
! <center>init-param</center>
 
! <center>Descriptions</center>
 
! <center>Descriptions</center>
Line 15: Line 20:
 
|-
 
|-
 
|  charset
 
|  charset
| [Optional][Default: <tt>UTF-8</tt>]
+
| [Optional][Default: <code>UTF-8</code>]
  
 
It specifies the default charset for the output of the DSP interpreter.
 
It specifies the default charset for the output of the DSP interpreter.
  
If an empty string is specified as follows, the container's default is used. In other words, the <tt>setCharacterEncoding</tt> method of ''javax.servlet.ServletResponse'' is not called.
+
If an empty string is specified as follows, the container's default is used. In other words, the <code>setCharacterEncoding</code> method of ''javax.servlet.ServletResponse'' is not called.
  
 
|-
 
|-
Line 31: Line 36:
 
|-
 
|-
 
|  compress
 
|  compress
| [Optional][Default: <tt>true</tt>]
+
| [Optional][Default: <code>true</code>]
  
It specifies whether to compress the output if the browser supports the compression (<tt>Accept-Encoding</tt>) and this Servlet is not included by other Servlets.
+
It specifies whether to compress the output if the browser supports the compression (<code>Accept-Encoding</code>) and this Servlet is not included by other Servlets.
  
 
|}
 
|}
  
=== How to Specify in web.xml ===
+
= Map URL to DSP Loader =
 +
 
 +
Notice it is optional. You need to specify it only if you want to use DSP pages (*.dsp) in your Web application.
  
 
<source lang="xml" >
 
<source lang="xml" >
<servlet>
+
<servlet>
    <servlet-name>zkLoader</servlet-name>
+
<servlet-name>dspLoader</servlet-name>
    <servlet-class>org.zkoss.web.servlet.dsp.InterpreterServlet</servlet-class>
+
<servlet-class>org.zkoss.web.servlet.dsp.InterpreterServlet</servlet-class>
</servlet>
+
</servlet>
 +
<servlet-mapping>
 +
<servlet-name>dspLoader</servlet-name>
 +
<url-pattern>*.dsp</url-pattern>
 +
</servlet-mapping>
 
</source>
 
</source>
  
==Version History==
+
= Optional Jar =
 +
{{versionSince | 9.0.0}}
 +
InterpreterServlet is split into a separate jar. It's no longer inside zweb.jar by default. If you want to use this servlet, you need to include the dependency below explicitly:
 +
 
 +
<syntaxhighlight lang='xml'>
 +
<dependency>
 +
<groupId>org.zkoss.common</groupId>
 +
<artifactId>zweb-dsp</artifactId>
 +
<version>9.6.4</version>
 +
</dependency>
 +
</syntaxhighlight>
  
 +
 
{{ZKConfigurationReferencePageFooter}}
 
{{ZKConfigurationReferencePageFooter}}

Latest revision as of 04:27, 19 May 2023


InterpreterServlet

[Optional] Class: InterpreterServlet

DSP Loader is a servlet used to process the DSP files. DSP is a JSP-like template technology.

It is optional. You need to specify it only if you have DSP pages in your Web application.

It takes the same syntax as that of JSP. Unlike JSP, DSP is interpreted at the run time, so it is easy to deploy DSP pages. No Java compiler is required in your run-time environment. In addition, you could distribute DSP pages in jar files. This is the way ZK is distributed.

However, you cannot embed Java codes in DSP pages. Actions of DSP, though extensible through TLD files, are different from JSP tags.

The Initial Parameters

init-param
Descriptions
charset [Optional][Default: UTF-8]

It specifies the default charset for the output of the DSP interpreter.

If an empty string is specified as follows, the container's default is used. In other words, the setCharacterEncoding method of javax.servlet.ServletResponse is not called.

class-resource [Optional][Default: false]


Specifies whether to load resources, such as TLD files, from the class loader, in addition to the servlet context.

compress [Optional][Default: true]

It specifies whether to compress the output if the browser supports the compression (Accept-Encoding) and this Servlet is not included by other Servlets.

Map URL to DSP Loader

Notice it is optional. You need to specify it only if you want to use DSP pages (*.dsp) in your Web application.

	<servlet>
		<servlet-name>dspLoader</servlet-name>
		<servlet-class>org.zkoss.web.servlet.dsp.InterpreterServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>dspLoader</servlet-name>
		<url-pattern>*.dsp</url-pattern>
	</servlet-mapping>

Optional Jar

Since 9.0.0 InterpreterServlet is split into a separate jar. It's no longer inside zweb.jar by default. If you want to use this servlet, you need to include the dependency below explicitly:

		<dependency>
			<groupId>org.zkoss.common</groupId>
			<artifactId>zweb-dsp</artifactId>
			<version>9.6.4</version>
		</dependency>



Last Update : 2023/05/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.