-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi I am new to ZK and I am trying to get work tutorial project, but when I try to go on h ttp://localhost:8080/searchMvc.zul i get following message:HTTP Status 500 - java.lang.ClassNotFoundException: main.java.tutorial.SearchController.
this is my filetree with serarchMvc.zul sourcecode: http://www.imagehosting.cz/images/picrhr.jpg
error: http://www.imagehosting.cz/images/bla2.jpg
ok, I have changed it like this: SearchController.java is in "package tutorial;", in searchMvc.zul "apply="tutorial.SearchController.java"", but it still doesn't work, when i go to h ttp://localhost:8080/searchMvc.zul, it throws error: HTTP Status 500 - java.lang.ClassNotFoundException: tutorial.SearchController.java Thx in advance.
<window title="Search" width="600px" border="normal" apply="tutorial.SearchController.java">
Should be like this
<window title="Search" width="600px" border="normal" apply="tutorial.SearchController">
It can't find it because you used the wrong package definition. It's not main.java.tutorial.SearchController. You don't include your source folders as part of the package name. Look at the top of your SearchController. What package did you declare? In your apply in the ZUL, use that package name and suffixed by .SearchController.
ok, I have changed it like this: SearchController.java is in "package tutorial;", in searchMvc.zul "apply="tutorial.SearchController.java"", but it still doesn't work, when i go to h ttp://localhost:8080/searchMvc.zul, it throws error: HTTP Status 500 - java.lang.ClassNotFoundException: tutorial.SearchController.java
<window title="Search" width="600px" border="normal" apply="tutorial.SearchController.java">
<hbox align="center">
Keyword:
<textbox id="keywordBox" />
<button id="searchButton" label="Search" image="/img/search.png" />
</hbox>
<listbox id="carListbox" height="160px" emptyMessage="No car found in the result">
<listhead>
<listheader label="Model" />
<listheader label="Make" />
<listheader label="Price" width="20%"/>
</listhead>
<template name="model">
<listitem>
<listcell label="${each.model}"></listcell>
<listcell label="${each.make}"></listcell>
<listcell>$<label value="${each.price}" /></listcell>
</listitem>
</template>
</listbox>
<hbox style="margin-top:20px">
<image id="previewImage" width="250px" />
<vbox>
<label id="modelLabel" />
<label id="makeLabel" />
<label id="priceLabel" />
<label id="descriptionLabel" />
</vbox>
</hbox>
</window>
searchController.java
package tutorial;
import java.util.List;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.select.SelectorComposer; import org.zkoss.zk.ui.select.annotation.; import org.zkoss.zul.;
public class SearchController extends SelectorComposer<component> {
private static final long serialVersionUID = 1L;
@Wire
private Textbox keywordBox;
@Wire
private Listbox carListbox;
@Wire
private Label modelLabel;
@Wire
private Label makeLabel;
@Wire
private Label priceLabel;
@Wire
private Label descriptionLabel;
@Wire
private Image previewImage;
private CarService carService = new CarServiceImpl();
@Listen("onClick = #searchButton")
public void 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();
previewImage.setSrc(selected.getPreview());
modelLabel.setValue(selected.getModel());
makeLabel.setValue(selected.getMake());
priceLabel.setValue(selected.getPrice().toString());
descriptionLabel.setValue(selected.getDescription());
}
}
Asked: 2013-05-17 11:10:24 +0800
Seen: 51 times
Last updated: May 20 '13
How any one know what you as trying it will be good if you post a link of your demo code war file
sjoshi ( 2013-05-17 11:22:34 +0800 )editPlease use good sites to post link of images the link you used showing adult content so i have to removed the link please use some good site to upload your images
sjoshi ( 2013-05-17 11:24:58 +0800 )edithow did you package it?
phdsong ( 2013-05-17 18:21:04 +0800 )editPlz post code no one can help wihout code
sjoshi ( 2013-05-20 06:04:47 +0800 )editPlz dont post code in answer section
sjoshi ( 2013-05-20 06:12:39 +0800 )edit