Monday, March 4, 2013

Zk form validation before button click.


<zk xmlns:x="xhtml" xmlns:zk="zk">
      <window width="100%" height="100%"
            viewModel="@id('vm') @init('test.test.Validation')"
            form="@id('fx') @load(vm) @save(vm,before='doSave')">

            <vlayout sclass="vertical-scroll" vflex="1">
                  <toolbar id="listToolbarProcess" sclass="vista"
                        height="20px" align="start">

                        <toolbarbutton label="Save"
                              onClick="@command('doSave')" />


                  <intbox id="priority" maxlength="3" constraint="no empty"
                        value="@bind(fx.value)" />
                  <datebox value="@bind("></datebox>



package test.test;

import java.sql.Timestamp;

import org.zkoss.bind.annotation.AfterCompose;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.zk.ui.Component;

public class Validation {

                 * @author Himanshu

                public void afterCompose(@ContextParam(ContextType.VIEW) Component view) {

                public void doSave() {

                                System.out.println(" value =" + str);
                                System.out.println(" Date Value =" + date);

                boolean check;

                public boolean isCheck() {
                                return check;

                public void setCheck(boolean check) {
                                this.check = check;

                Integer value;

                public Integer getValue() {
                                return value;

                public void setValue(Integer value) {
                                this.value = value;

                String str;

                public String getStr() {
                                return str;

                public void setStr(String str) {
                                this.str = str;

                Timestamp date;

                public Timestamp getDate() {
                                return date;

                public void setDate(Timestamp date) {
                       = date;


How to Calculate the Future Investment Value of Investment.

Below java program for calculate future investment value. Here calculate s using the formula futureInvestmentValue =investmentAmount x (...