-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello.
I use Spring Web MVC and need to get Ajax and some components from ZK. So I try following code:
<%@ taglib uri="http://www.zkoss.org/2005/zul/jsp/" prefix="z" %> <z:variable-resolver use="org.zkoss.zkplus.spring.DelegatingVariableResolver"/> ... <z:page> <z:textbox name="sample" value="${cardListController.test}"/>
org.zkoss.zk.ui.UiException: javax.servlet.jsp.JspException: java.lang.NullPointerException
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
org.zkoss.lang.Classes.newInstance(Classes.java:78)
org.zkoss.lang.Exceptions.wrap(Exceptions.java:164)
org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:46)
org.zkoss.jsp.zul.impl.RootTag$MyRichlet.service(RootTag.java:307)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:398)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:292)
while jsp parsing.
What do I do wrong?
And may be could you advise me the better way to use ZK Ajax with Spring Web MVC? I need to access ModelAndView objects and form object from ZK tags. And I need only something like
<z:textbox name="sample" onChange="${cardListController.bar( ${myForm} )}"/>
I found out how to call static method on full named class, but it's not convenient, cause I need to access non-static fields in my spring controller.
Hi Donz,
You can refer this smalltalk to get ZK Integrated with Spring:
http://www.zkoss.org/smalltalks/zkspringwf/
Hi Donz,
Can you provide a runnable sample code of your work? Thx.
Hello.
My investigation follows:
<%@ page contentType="text/html;charset=windows-1251" language="java" pageEncoding="windows-1251" %> <%@ include file="/WEB-INF/jsp/include.jsp" %> <%--Include Spring context--%> <z:variable-resolver use="org.zkoss.zkplus.spring.DelegatingVariableResolver"/> <%-- Use annotation binding --%> <z:init use="org.zkoss.zkplus.databind.AnnotateDataBinderInit"/> <form:form method="post" action="${contextPath}/cards/list.html" name="form.cards"> <z:page> <%--Variables for ZK--%> <z:variables command="${command}" local="false"/> <z:variables cardList="${cardList}" local="false"/> <z:variables testLabelText="Тестовая метка" local="false"/> <%--Use ZK var with annotation binding--%> <div class="bl04"><z:label id="testLabel" value="@{cardList}"/></div> <%--Use spring object. This label couldn't be updated because of not using ZK var--%> <div class="bl04"><z:label id="testLabel2" value="${cardList[0]}"/></div> <div class="bl03"> </div> <div class="bl04"> <div class="bl05r2"> <div class="bl05l"> <%--Calling method from spring bean with ZK vars as parameters and update component 'testLabel'. In my case method showTrashed remove first element of cardList list--%> <div class="chkbx1"><z:checkbox name="showTrashed" onCheck="cardListController.showTrashed( command, cardList ); binder.loadComponent( testLabel )"/></div> </div> <div class="select_txt"><spring:message code="checkTrashedLabel"/></div> </div> </div> </z:page> </form:form>
Asked: 2009-01-29 18:04:42 +0800
Seen: 446 times
Last updated: Feb 03 '09