0

can we use composer in jsp page

asked 2009-05-12 10:24:10 +0800

hawk gravatar image hawk
2295 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2009-05-12 10:28:37 +0800

Hi, everybody here:
I got problems using zk jsp tag.

related code:

in main.jsp
<%@ taglib prefix="z" uri="http://www.zkoss.org/jsp/zul" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>

<html>
<head>
<title>管理主畫面</title>
</head>
<body>
<z:page>
登入帳號:<security:authentication property="principal.username"/>
<z:button label="登出" href="../j_spring_security_logout" />
<z:zscript>
import ...
...
import org.zkoss.zkplus.spring.SpringUtil;

MainComposer mainComposer = new MainComposer();
EmployeeDAO employeeDAO = (EmployeeDAO)SpringUtil.getBean("employeeDAO");
CompanyDAO companyDAO = (CompanyDAO)SpringUtil.getBean("companyDAO");
mainComposer.setEmployeeDAO(employeeDAO);
mainComposer.setCompanyDAO(companyDAO);
</z:zscript>
<z:window apply="${mainComposer}">
</z:window>

Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.zkoss.jsp.zul.impl.LeafTag.setDynamicAttribute(LeafTag.java:246)
at org.apache.jsp.management.main_jsp._jspx_meth_z_005fwindow_005f0(main_jsp.java:150)
at org.apache.jsp.management.main_jsp.access$3(main_jsp.java:142)
at org.apache.jsp.management.main_jsp$main_jspHelper.invoke0(main_jsp.java:962)
at org.apache.jsp.management.main_jsp$main_jspHelper.invoke(main_jsp.java:1217)
at org.zkoss.jsp.zul.impl.RootTag$MyRichlet.service(RootTag.java:300)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:398)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:292)
at org.zkoss.jsp.zul.impl.RootTag.doTag(RootTag.java:268)
at org.apache.jsp.management.main_jsp._jspx_meth_z_005fpage_005f0(main_jsp.java:93)
at org.apache.jsp.management.main_jsp._jspService(main_jsp.java:68)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)

the system can load the page normally only with zscript, so I think zscript is correct.
but after I add apply="${mainComposer}" to window, the system show lots exception like above.
I found ZK JSP Tags User Guide said that apply attribute is fully supported.

I use zk JSP 1.3.

Can someone help me?

delete flag offensive retag edit

2 Replies

Sort by » oldest newest

answered 2009-05-12 10:35:00 +0800

hawk gravatar image hawk
2295 1 5
http://hawkphoenix.blogsp... ZK Team

sorry, I got reason.
I don't add listener in web.xml.
<listener>
<description>ZK JSP Tags environment initiation </description>
<display-name>ZK JSP Initiator</display-name>
<listener-class>org.zkoss.jsp.spec.JspFactoryContextListener</listener-class>
</listener>

but even I don't add this listener , the jsp tag still can work except EL.

link publish delete flag offensive edit

answered 2009-05-13 01:02:45 +0800

hideokidd gravatar image hideokidd
750 1 2

updated 2009-05-13 01:04:29 +0800

Hi,

I'm not sure what's wrong,
but I usually apply composer to a component like

<z:window apply="MainComposer">

The use is from smalltalk
http://docs.zkoss.org/wiki/ZK_MVC_Made_Easy
In your code you apply an instance of the composer class to the window,
maybe you could try the way the smalltalk used.

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-05-12 10:24:10 +0800

Seen: 275 times

Last updated: May 13 '09

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