0

Changing URL-Pattern

asked 2010-04-29 11:03:57 +0800

TOtte gravatar image TOtte
93 2

Hi,
I want to change / hide my url pattern, but can't get it to work.
I have found this http://www.zkoss.org/doc/devguide/ch11s11s02.html, but I am not using richlets.

So right now my url pattern is: $serverurl/$applicationname/Pages/$somefolder/$somezul.zul
My index file is contained in the Pages directory.
What i would like to do would be to reach the index at $serverurl/$applicationname/index.zul and then the url should just stay at that. The user doesn't need to know about my internal folder structure.

Can anybody explain what I need to configure in web.xml or somewhere else to achieve this?
Thank you!

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2010-05-04 07:00:50 +0800

iantsai gravatar image iantsai
2755 1

you can use component.getChildren().clear(); and Execution.createComponents(...); to achieve this.

link publish delete flag offensive edit

answered 2010-05-05 09:23:51 +0800

TOtte gravatar image TOtte
93 2

Thanks for your answer iamtsai. So i would have to do that in every controller?

Isn't there a way like in java server pages, where you can specify a url pattern for the whole application in one of the configuration files?

link publish delete flag offensive edit

answered 2010-05-10 21:29:55 +0800

iantsai gravatar image iantsai
2755 1

Please forget Page Based programming model, The programming paradigm of ZK is more like Swing & Mozilla XUL than JSP or JSF.

If you really like a configuration file to manage the URL, you can use ZK Macro Component + Language Addon to do it.
Macro Component is a way to wrap your ZUL page as a Composite in Swing, with the definition(Lang-Addon) in zk.xml, you can use it in your zul file just like a real component.

And I've seen some developer even use Spring Framework to configure his own Layout structure.
A ZK's component always need to implement default constructor, that's a huge benefit for you to do anything.

link publish delete flag offensive edit

answered 2010-05-12 13:03:04 +0800

buggy gravatar image buggy
57 2

Hi TOtte an iantsai,
May I ask how to you achieve your url ($serverurl/$applicationname/Pages/$somefolder/$somezul.zul) without using richlet??
I trying to make my web page to understand simple URL like
$serverurl/$applicationname/Home
or
$serverurl/$applicationname/Catalog

to more complex URL like
$serverurl/$applicationname/Catalog/ForMen/T-Shirts/BlackAndWhiteTee
but I don't know how. What I use now is Richlet and my pages URL have to be like
$serverurl/$applicationname/RichletName/HomeOrWhatever

I want to get rid of the RichletName in the URL, if that is possible. Any pointers would be greatly appreciated!!!
Thanks in advance!!

link publish delete flag offensive edit

answered 2010-05-13 20:24:28 +0800

iantsai gravatar image iantsai
2755 1

There's a lot of way to do it, you can simply create a Servlet as a dispatcher which will handle the easy URL you mentioned by forwarding.

this is the easiest way to do it.

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2010-04-29 11:03:57 +0800

Seen: 393 times

Last updated: May 13 '10

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