Not unique in the new ID space | ZK

zk

Solution

A common mistake when using ZK is to stay in the request/response cycle in your head. ZK doesn't do request/response cycle. Forget about it. ZK is like Swing: You create the UI, you put your data in models and then let the framework render everything.

In your case, you probably try to add the `ListBox` to the UI again (because that's what you're used to from JSPs). Don't do that. Just update the models which are attached to the `ListBox` and ZK will refresh the HTML for you.

Problem

I am creating 2 `ListBox` in my Java code using ZK and assigning those `ListBox` unique Ids.This is my flow. - Customer select values from the drop box. - Hit Save button - Values passes to Underlying Service and status got update. - We refresh page with help of another event. Here is how I am creating Listbox ``` Listbox listbox=createListbox(widget,OrderStatus.ORDERSTATUS.class, null,orderStatus); listbox.setId(ORDER_STATUS_ID); ``` Everything is working fine for the first time, but when I am doing it next time, though underlying code is working fine but I am getting following error message for second time and so on. ``` Not unique in the new ID space: orderStatusId ``` Issue is related to enter link description here but being new to ZK not sure what can be best way to achieve that. For me issue seems when We are refreshing page after successful order status update, as code is being executed again and seems it has already that Id assign to it. Page Refresh Code ``` button.addEventListener("onClick", new EventListener() { public void onEvent(Event event) throws Exception { DetailsWidgetRenderer.this.handleRefreshEvent(widget, event); } }); ```

Original source