ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

Using a Java Class , Error Multiple annotations

gramberg
29 May 2010 06:20:26 GMT
29 May 2010 06:20:26 GMT

Hi,

I am new to ZK and I try to rebuild the example with databinding.
http://docs.zkoss.org/wiki/Data_binding
I use ZK-Studio with Eclipse 3.5

I made a seperate Class Gutacht and use this class it in my ZK-File,
but I get the message: multiple annotions found, - Gutacht cannot be resolved to a type.
What is missing at my example ?

It is the first time, that I have a separate java-file.


gutacht.zul  
<zscript><![CDATA[
	<b >Gutacht gut = new Gutacht()</b>;   //<<--- line with the error 
]]>



Gutacht.java
public class Gutacht {
	private String _nr = "55";
	private String _kurz = "Bernhard Gramberg";
 
	// getter and setters
	public void setNr (String nr) {
		_nr = nr ;
	}	

gramberg
29 May 2010 10:00:21 GMT
29 May 2010 10:00:21 GMT

solved:

There has been two problems:

1. Package must have a name other than "(default package)"
2. Import was missing.

What I did:

- created a new package
- use an import statment

Thanks to Stephan for the hint.


Java-File:

package de.gramberg.model;

public class Gut {
	private String _nr = "55";
	private String _kurz = "Bernhard Gramberg";

	// getter and setters

ZUL-File:

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>

<zk>

<zscript>

<![CDATA[
    import de.gramberg.model.Gut;  
                  
    Gut gut = new Gut();
	// gut.setNr("100");
	// gut.setKurz("Hanks");
]]>