# ZK SpringBoot 2.5.3, zkspringboot-demo-jar project, zhtml extension is not working.

franferri
48 2

Hello

ZK SpringBoot 2.5.3, zkspringboot-demo-jar project, zhtml extension is not working.

I have placed my .zhtml in the resources/web/zul website where the .zul files are. I have created the following mapping (in the DemoApplication.java file):

@GetMapping("/html")
public String htmlExample() {
return "html";
}


Why is not picking it?

the demo application.properties files shows:

zk.zul-view-resolver-prefix=/zul

How do we use in Springboot demo project zhtml files?

thanks!

Update with more data: I run the server with:

./mvnw clean package -DskipTests;
./mvnw spring-boot:run


Maybe this is a limitation due the current implementation, and only will work using a .war in a webserver instead of running the .jar (with embedded tomcat):

Can anybody help me? Thanks!

delete retag edit

Sort by » oldest newest most voted

cor3000
6094 2 7

short answer: The DHtmlLayoutServlet which handles both .zul and .zhtml pages is not available in a jar deployment. The DHtmlUpdateServlet can only handle .zul files .zhtml files cannot be processed right now. For now you have to use the war-deployment method for full backwards compatiblity with existing zk applications, include .zhtml support.

Why is not picking it? The view resolver can be configured to pick up zhtml files by specifying a different view resolver suffix, the prefix is irrelevant there and can be anything that matches your folder structure.

zk.zul-view-resolver-suffix=.zhtml


Then the view resolver will zhtml files. However there's a shorter way to verify this by just using the explicit URL to the servlet directly, no need to go through spring-mvc's dispatcher servlet.

e.g. http://myserver:8080/zkau/web/zul/html.zhtml

The problem now is what I described above... the zhtml file is not parsed/processed and returned as plain text instead ... which is of course useless.

Further it's possible to also configure the ZumlExtendlet (handling zul files, via /zkau/web/*/.zul) also for zhtml files. But that isn't supported/working right now (possibly never considered a use case) and leads to an exception. ---> That means back to war-deployment.

I posted a new Feature Request: ZK-5007 to enable handling .zhtml files through the DHtmlUpdateServlet to allow this configuration in a jar deployment as well.

Once that's available, I can also implement an auto-config option for ZK Spring Boot (I am the maintainer of zkspringboot).

cor3000 many thanks for all the details. Delightful. I'm using 100% spring boot auto-config, quite nice. I think if is possible to enable all the options for the .jar too will be amazing, so, for developers is a no brainer.

( 2021-08-27 21:56:41 +0800 )edit

yes I agree that would be great, I don't think this FR will get the highest priority since (most zhtml scenarios can be also represented as zul files). Anyway you can watch/vote for the ticket in JIRA and I'll keep you updated here.

( 2021-08-30 11:45:12 +0800 )edit
[hide preview]