Getting started with ZK-Jakarta"

From Documentation
Line 67: Line 67:
 
In most cases, the imported class will use the same name and package structure:
 
In most cases, the imported class will use the same name and package structure:
  
{| border='1px'
+
{| border='1px' | width="100%"
!Original package!!Migrated package!
+
!Original package!!Migrated package
 
|-
 
|-
 
| Javax.servlet
 
| Javax.servlet

Revision as of 11:07, 25 May 2021


Getting started with ZK-Jakarta



This guide's purpose is to provide an easy-to-setup environment to develop a ZK application using ZK 9.6 and a Jakarta-compliant run environment in Eclipse.

Disclaimer

Please make sure that you are using the up-to-date versions of the softwares described in this example when installing yourself.

Environment setup

Please refer to the the eclipse and maven quick start guide environment setup.

Project configuration

This section details the configuration steps necessary to run your project in a servlet 5.0 context.

Maven dependencies configuration

ZK supports the Jakarta servlet configuration starting from ZK 9.6.0-jakarta. When updating your pom file, you need to include the -jakarta suffix in your dependencies version configuration:

<dependency>
<zk.version>9.6.0-jakarta</zk.version>
<!--<zk.version>9.6.0-jakarta-Eval</zk.version> -->
...
<dependency>
	<groupId>org.zkoss.zk</groupId>
	<artifactId>zk</artifactId>
	<version>${zk.version}</version>
</dependency>

For a more in-depth look at the pom.xml file configuration, please refer to the the Resolving ZK Framework Artifacts via Maven page .

If your project uses the servlet-API dependency, you will need to update your pom file to use the Jakarta servlet-API instead. See here for a list of available versions.

For example, you may need to replace

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>${servlet.version}</version>
    <scope>provided</scope>
</dependency>

by

<dependency>
    <groupId>jakarta.servlet</groupId>
    <artifactId>jakarta.servlet-api</artifactId>
    <version>${servlet.version}</version>
    <scope>provided</scope>
</dependency>

Java classes

If you have replaced the servlet-API dependency for you project, you will need to refactor Java classes which imports related classes.

For example, you may have a custom servlet implementing javax.servlet.Servlet, or you may be using the javax.servlet.http.HttpServletRequest

In this case you will need to replace these imports by the equivalent one from the Jakarta Servlet-API library. In most cases, the imported class will use the same name and package structure:

Original package Migrated package
Javax.servlet jakarta.servlet
Javax.servlet.Servlet jakarta.servlet.Servlet
Javax.servlet.http.HttpServletRequest jakarta.servlet.http.HttpServletRequest
Etc.


We recommend that you also refer to the update guide for your preferred run environment.

Version History

Version Date Content
1.0.0 May 2021 Documentation relative to ZK 9.6.0-Jakarta



Last Update : 2021/05/25

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