0

Image loading URL....

asked 2018-03-15 07:20:35 +0800

Sam888 gravatar image Sam888
1

Hi all,

I am studying the code from 'ZK Spring Boot' from ZK demo and have question about the URL used to load image using <image>.

To be exact, the file resources.zul has code for loading image and I don't understand how it works.

* The uri "/" used in <image> seems to be hard coded to load image from /src/main/resources/static/ in ZK framework.
  Example:
    <image src="/img/zklogo1.png" width="100px"/>

* The uri "~./" used in <image> seems to be hard coded to load image from /src/main/resources/web/ in ZK framework.
  Example:
        <image src="~./img/zklogo3.png" width="100px"/>

Am I right in the above assumptions or am I missing some config somewhere?

Thanks, Sam

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-03-15 10:44:25 +0800

cor3000 gravatar image cor3000
6280 2 7

I wouldn't say hard coded, but it's the default resource folders in both frameworks.

spring boot uses the static package ( and files/folders below )

zk uses the a different the web package ( and files/folders below ) in ZK called: class-web-resource (CWR)

This example is targetting developers experienced with both ZK and Spring Boot. The resource.zul case simply shows how both springs and zk's default mechanism still work side-by-side.

Since a spring boot application doesn't need/have a classical WebContent folder you need a place to put your resources. So I gave 2 options ... the Spring guys maybe prefer the spring way, ZK experienced developers might like to keep their existing class-web-resource structure.

So yes your observation is right, there are 2 parallel ways to serve resources. 2 Frameworks, 2 Ways.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2018-03-15 07:20:35 +0800

Seen: 17 times

Last updated: Mar 15 '18

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More