23.12.2012 Views

ZK Developer's Guide

ZK Developer's Guide

ZK Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Online Media Library<br />

<br />

A Song.<br />

<br />

<br />

A Movie.<br />

<br />

<br />

The id for the media. That is a user defined id. The id<br />

must be unique.<br />

<br />

<br />

The description for the media.<br />

<br />

<br />

Upload a image for the media.<br />

<br />

<br />

How to redirect to other pages<br />

It is often necessary to redirect to another page after an action is<br />

executed. In that case, the <strong>ZK</strong> framework offers the general utility<br />

class org.zkoss.zk.ui.Executions. This method offers the<br />

sendRedirect method. In a ZUL page, you could directly access the<br />

Executions instance and redirect to another page (e.g. Exectutions.<br />

sendRedirect('index.zul')). A redirect sends a response to the<br />

client giving it a new URL. The client then requests the new URL. A<br />

forward happens internally in the servlet container. The target is given<br />

the chance to respond to the original request. If you use the browser's<br />

back button the same request is sent again.<br />

For the first version of the update, we extend index.zul with a textbox component<br />

beside a toolbarbutton of Update a media.<br />

The extended index.zul is shown below:<br />

<br />

<br />

<br />

[ 62 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!