Search button in tutorial does not work

asked 2013-03-03 07:17:05 +0800

mindcrime gravatar image mindcrime
3 2

updated 2013-03-03 08:37:33 +0800

Hi all, I'm going through the ZK tutorial and working with the provided sample app, as documented at books.zkoss.org/wiki/ZKGettingStarted/GetZKUpandRunningwithMVC#ImportandRunExampleApplication

I have the app deployed to Tomcat successfully and hitting localhost:8080/tutorial/search.zul renders the search page. But when I type a keyword in the search box and click the Search button, nothing happens. No call is made to the backend (verified by setting a breakpoint and running in debug mode), and nothing appears in the Javascript console in the browser.

I've tried with with both Chrome and Firefox and the behavior is the same in both cases.

I have not modified the tutorial sample app code, but here is the contents of my search.zul in case it helps:

<window title="Search" width="600px" border="normal">
    <hbox align="center">
        <textbox id="keywordBox"/>
        <button id="searchButton" label="Search" image="/img/search.png"/>
    <listbox id="carListbox" height="160px" emptymessage="No car found in the result">
            <listheader label="Model"/>
            <listheader label="Make"/>
            <listheader label="Price" width="20%"/>
            <listcell label="product name"></listcell>
            <listcell label="make"></listcell>
            <listcell>$<label value="price"/></listcell>
    <hbox style="margin-top:20px">
        <image id="previewImage" width="250px"/>
            <label id="modelLabel"/>
            <label id="makeLabel"/>
            <label id="priceLabel"/>
            <label id="descriptionLabel"/>

and SearchController looks like this:

public class SearchController extends SelectorComposer<component> {

    private static final long serialVersionUID = 1L;

    private Textbox keywordBox;
    private Listbox carListbox;
    private Label modelLabel;
    private Label makeLabel;
    private Label priceLabel;
    private Label descriptionLabel;
    private Image previewImage;

    private CarService carService = new CarServiceImpl();

    @Listen("onClick = #searchButton")
    public void search(){
        System.out.println( "doing search" );
        String keyword = keywordBox.getValue();
        List<car> result = carService.search(keyword);
        carListbox.setModel(new ListModelList<car>(result));

    @Listen("onSelect = #carListbox")
    public void showDetail(){
        Car selected = carListbox.getSelectedItem().getValue();
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-04 02:44:48 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8

Apply is missing as shown here

<window title="Search" width="600px" border="normal" apply="demo.SearchController">

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

1 follower



Asked: 2013-03-03 07:17:05 +0800

Seen: 19 times

Last updated: Mar 04 '13

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