ZATS Richlet"

From Documentation
(Created page with "{{Template:UnderConstruction}} {{ZATSEssentialsPageHeader}} ZATS Mimic also support Richlet<ref>for more detail, please refer to [[ZK_Developer%27s_Reference/UI_Composing/Richle...")
 
Line 22: Line 22:
 
<url-pattern>/foo</url-pattern>
 
<url-pattern>/foo</url-pattern>
 
</richlet-mapping>
 
</richlet-mapping>
 +
</source>
 +
 +
'''MyRichlet.java'''
 +
<source lang="java" start="10" high="">
 +
public class MyRichlet extends GenericRichlet {
 +
public void service(Page page) throws Exception {
 +
final Label msg = new Label("Hello world!");
 +
msg.setId("msg");
 +
msg.setPage(page);
 +
Button btn = new Button("go");
 +
btn.setId("btn");
 +
btn.setPage(page);
 +
btn.addEventListener(Events.ON_CLICK, new EventListener() {
 +
public void onEvent(Event event) throws Exception {
 +
msg.setValue("Hello ZK!");
 +
}
 +
});
 +
}
 +
}
 
</source>
 
</source>
  

Revision as of 03:35, 12 June 2012

WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!

aowang



ZATS Mimic also support Richlet[1].

web.xml

<servlet-mapping>
	<servlet-name>zkLoader</servlet-name>
	<url-pattern>/zk/*</url-pattern>
</servlet-mapping>

zk.xml

<richlet>
	<richlet-name>MyRichlet</richlet-name>
	<richlet-class>foo.MyRichlet</richlet-class>
</richlet>
<richlet-mapping>
	<richlet-name>MyRichlet</richlet-name>
	<url-pattern>/foo</url-pattern>
</richlet-mapping>

MyRichlet.java

public class MyRichlet extends GenericRichlet {
	public void service(Page page) throws Exception {
		final Label msg = new Label("Hello world!");
		msg.setId("msg");
		msg.setPage(page);
		Button btn = new Button("go");
		btn.setId("btn");
		btn.setPage(page);
		btn.addEventListener(Events.ON_CLICK, new EventListener() {
			public void onEvent(Event event) throws Exception {
				msg.setValue("Hello ZK!");
			}
		});
	}
}

Notes

  1. for more detail, please refer to ZK_Developer's_Reference/UI_Composing/Richlet



Last Update : 2012/06/12

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.