0

Custom Classes in ZK Studio (Eclipse)

asked 2009-09-26 17:07:51 +0800

creature gravatar image creature
9 1

Hi - I am a ZK beginner.

I successfully installed the ZK Plugins in Eclipse and created the Hello World test project. Next i wanted to add a Data Binding to mysql Database. I see custom java src-files go into the src folder. The built classes go into the built folder.

But when i try to import my custom classes in the zul page - i get the error that the class file cannot be resolved in Eclipse. Do i have to manually copy the class files to the WebContent directory or how is it correctly done?

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2009-09-28 07:06:34 +0800

ziftech gravatar image ziftech
87 2

Could you provide the source code of files?

link publish delete flag offensive edit

answered 2009-10-01 10:07:59 +0800

creature gravatar image creature
9 1

I have the file <ProjectRoot>/src/ClientEvent.java

import java.sql.Date;

public class ClientEvent
{
	public Date datum;
	public String thema;
	public String email;
	
	public ClientEvent() {}
	public ClientEvent(Date datum, String thema, String email)
	{
		this.datum = datum;
		this.thema = thema;
		this.email = email;
		
	}
}

Building the projects creates the file <ProjectRoot>/build/classes/ClientEvent.class

From the "Hello World" Application i have the file <ProjectRoot>/WebContent/index.zul

<?page title="Auto Generated index.zul"?>
<window title="Hello World!!" border="normal" width="200px">
<zscript><![CDATA[
import ClientEvent;

]]></zscript>
</window>

And the import cannot be resolved.

link publish delete flag offensive edit

answered 2009-10-01 10:21:01 +0800

smigol gravatar image smigol flag of Italy
316 2

use this:

<zscript>
    <![CDATA[//@IMPORT
	import ClientEvent;
    ]]>

    <![CDATA[//@DECLARATION
      //DECLARE METHOD
    ]]>


    <![CDATA[
     //OTHER
    ]]>


</zscript>

link publish delete flag offensive edit

answered 2009-10-01 11:58:31 +0800

creature gravatar image creature
9 1

But Eclipse still says: "The import ClientEvent cannot be resolved"

link publish delete flag offensive edit

answered 2009-10-07 09:55:27 +0800

iantsai gravatar image iantsai
2755 1

Java coder rule number 1:

DO NOT USE DEFAULT PACKAGE.

link publish delete flag offensive edit

answered 2009-10-17 03:22:19 +0800

MichaelC gravatar image MichaelC
45

create a package for your your class. right click on the src folder, click new package, name it something like com.zkexperiment.hello. Drag your class into that package and follow the prompts. place the fully qualified name into your CDATA script.

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

RSS

Stats

Asked: 2009-09-26 17:07:51 +0800

Seen: 1,070 times

Last updated: Oct 17 '09

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