Date Created: Wed 29-Dec-2010

Related Document Categories:


    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


Middleware Mentor - Steven Charles Robinson

About Me

Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.

Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.

Follow Steve as @stevencrobinson on twitter.

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

Oracle WebLogic Categories

JBoss Categories

Other Categories