Date Created: Wed 29-Dec-2010

Related Document Categories:

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


ZK HREF how to.

Lets say you have a timeout.zul page for Spring security and you want to provide a simple link for users to re-login once they have been presented with "timeout" page then you would want ZK to provide a links. You might be tempted to use HTML. But this is not the be simplest nor best way.

Wrong Way.
The <html> component is used to "show" native html "As IS". Meaning ZK does not have control in its contents. ZK simply "output" the HTML"As typed", much like pass thru HTML.

Using and HTML name space allows for in-line HTML, this is not what you want as the URI "/login.zul" means root of web container,not the context root for your application. http://localhost/login.zul is what will happen as opposed to http://localhost/mywebapp/login.zul


<?page title="Session Timeout" contentType="text/html;charset=UTF-8"?>
<zk xmlns:html="http://www.w3.org/1999/xhtml">
<window width="80%" title="Session Timeout" border="normal">
<vbox>
The page or component you request is no longer available.
This is normally caused by timeout, opening too many Web pages, or rebooting
the server.
</vbox>
<html:br />
<html:a href="/login.zul">Re-Login</html:a>

</window>
</zk>

Right Way

Using a toolbar element means that XK is rendering and it knows the context root and so the path is correct. ie http://localhost/mywebapp/login.zul

<?page title="Session Timeout" contentType="text/html;charset=UTF-8"?>
<zk>
<window width="80%" title="Session Timeout" border="normal">
<vbox>
The page or component you request is no longer available.
This is normally caused by timeout, opening too many Web pages, or rebooting
the server.
</vbox>

<label pre="true" value="Login Link >> "/><toolbarbutton label="Re-Login"
href="/login.zul"/>


</window>
</zk>

Result

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


  • Linked In
  • Twitter
  • About Me
  • My Blog
  • Contact Me

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories