0

cant bind .zul file to java class

asked 2013-05-17 11:10:24 +0800

demizon gravatar image demizon
179 1 6

updated 2013-05-20 06:14:49 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

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.

delete flag offensive retag edit

Comments

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 )edit

Please 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 )edit

how did you package it?

phdsong ( 2013-05-17 18:21:04 +0800 )edit

Plz post code no one can help wihout code

sjoshi ( 2013-05-20 06:04:47 +0800 )edit

Plz dont post code in answer section

sjoshi ( 2013-05-20 06:12:39 +0800 )edit

5 Answers

Sort by ยป oldest newest most voted
0

answered 2013-05-20 06:13:47 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...
<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">
link publish delete flag offensive edit
0

answered 2013-05-20 01:12:07 +0800

rdgrimes gravatar image rdgrimes
735 7

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.

link publish delete flag offensive edit
0

answered 2013-05-20 05:55:39 +0800

demizon gravatar image demizon
179 1 6

updated 2013-05-20 06:02:20 +0800

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

link publish delete flag offensive edit
0

answered 2013-05-20 06:09:48 +0800

demizon gravatar image demizon
179 1 6
<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>

link publish delete flag offensive edit
0

answered 2013-05-20 06:11:44 +0800

demizon gravatar image demizon
179 1 6

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());
}

}

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

Follow
1 follower

RSS

Stats

Asked: 2013-05-17 11:10:24 +0800

Seen: 51 times

Last updated: May 20 '13

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