-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4830454
By: crisyag
Hello ZK team,
I work in a project that develops tools for a learning management system called Sakai <http://sakaiproject.org/>. Sakai is an education portal in which we can add new tools, and we are planning to use ZK in a tool that we are developing.
Sakai provides us an eclipse plugin to create tools according to its architecture and, in terms of UI, it generates JSP or JSF -based tools. So I tried to use ZK JSF components, but got no success with a simple demo.
As Sakai eclipse plugin includes many servlets and listeners in web.xml, it probably messes ZK. I used the following example from ZK JSF Demo:
<z:page>
<z:window title="click counter" border="normal">
<z:label id="lab" />
<br />
<z:button label="click">
<z:attribute name="onClick">
lab.value = "Count:"+ (++count);
</z:attribute>
</z:button>
<z:vbox id="pics" />
<z:zscript>
int count = 0;
lab.value = "Count:"+count;
</z:zscript>
</z:window>
</z:page>
The page loads correctly but I got the message "The page or component you request is no longer available: g47m. This is normally caused by timeout, or opening too many web pages. You have to reload the page and try again" when I click the button. On the other hand, this demo runs perfectly outside Sakai. My environment
is: Tomcat 5.5, Myfaces 1.1.1.
Here is my web.xml containing parts generated automatically by sakai eclipse plugin and parts of ZK:
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file generated by Sakai App Builder -AZ --> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>sakai-testezkjsf</display-name>
<description>Sakai Testezkjsf</description>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<!-- //// -->
<!-- ZK -->
<filter>
<filter-name>ZK FacesContext Filter</filter-name>
<filter-class>
org.zkoss.jsf.zul.util.HttpFacesContextFilter
</filter-class>
<!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet).
It must be the same as <url-pattern> for the update engine.
-->
<init-param>
<param-name>update-uri</param-name>
<param-value>/zkau</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ZK FacesContext Filter</filter-name>
<servlet-name>zkLoader</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>ZK FacesContext Filter</filter-name>
<servlet-name>auEngine</servlet-name>
</filter-mapping>
<listener>
<description>
Used to cleanup when a session is destroyed
</description>
<display-name>ZK Session Cleaner</display-name>
<listener-class>
org.zkoss.zk.ui.http.HttpSessionListener
</listener-class>
</listener>
<listener>
<listener-class>
org.apache.myfaces.webapp.StartupServletContextListener
</listener-class>
</listener>
<servlet>
<description>ZK loader for evaluating ZK pages</description>
<servlet-name>zkLoader</servlet-name>
<servlet-class>
org.zkoss.zk.ui.http.DHtmlLayoutServlet
</servlet-class>
<!-- Must. Specifies URI of the update engine
(DHtmlUpdateServlet). -->
<init-param>
<param-name>update-uri</param-name>
<param-value>/zkau</param-value>
</init-param>
<load-on-startup>1</load-on-startup><!-- MUST -->
</servlet>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.zul</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.zhtml</url-pattern>
</servlet-mapping>
<servlet>
<description>The asynchronous update engine for ZK</description>
<servlet-name>auEngine</servlet-name>
<servlet-class>
org.zkoss.zk.au.http.DHtmlUpdateServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>auEngine</servlet-name>
<url-pattern>/zkau/*</url-pattern>
</servlet-mapping>
<!-- //// -->
<!-- Sakai request filter -->
<filter>
<filter-name>sakai.request</filter-name>
<filter-class>org.sakaiproject.util.RequestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sakai.request</filter-name>
<servlet-name>FacesServlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!-- Tool Servlet -->
<servlet>
<!-- servlet name must match tool.id in tools xml file -->
<servlet-name>sakai.testezkjsf</servlet-name>
<servlet-class>org.sakaiproject.jsf.util.JsfTool</servlet-class>
<init-param>
<param-name>default</param-name>
<param-value>HelloWorld</param-value>
</init-param>
<init-param>
<param-name>path</param-name>
<param-value>/testezkjsf</param-value>
</init-param>
<init-param>
<param-name>default.last.view</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet -->
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<!-- Sakai listeners -->
<listener>
<listener-class>
org.sakaiproject.util.ToolListener
</listener-class>
</listener>
<listener>
<listener-class>
org.sakaiproject.util.ContextLoaderListener
</listener-class>
</listener>
</web-app>
And here are the contents of my zk.xml:
<listener>
<description>ThreadLocal Variables Synchronizer</description>
<listener-class>
org.zkoss.zkplus.util.ThreadLocalListener
</listener-class>
</listener>
<preference>
<name>ThreadLocal</name>
<value>
javax.faces.context.FacesContext=_currentInstance;
</value>
</preference>
<desktop-config>
<desktop-timeout>3600</desktop-timeout>
</desktop-config>
So, the big problem is web.xml? How can I fix it?
Looking forward to an answer,
Thanks,
Cristiane Yaguinuma.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4833602
By: jebberwocky
Dear Yaguinuma
It works in my testing enviroment.
ZK JSF Components 2.0
Myfaces 1.2.2
Tomcat 6.0
Since that I am not familiar with Sakai, could you please provide the enviroment which you use?
Thank you!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4835419
By: crisyag
Thanks for your answer, jebberwocky
Well, first of all, Sakai uses JSF 1.1 so I cannot use ZK JSF Components 2.0 (JSF 1.2). Then I tried ZK JSF Components 1.0.0 in tomcat 5.5.23 and myfaces
1.1.1 (both recommended by sakai), still no success.
However, I tried ZK JSP-tags 1.1.0 in the same environment and I got it working.
Here is the web.xml in this case:
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file generated by Sakai App Builder -AZ --> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>sakai-testezkcrud</display-name>
<description>Sakai Testezkcrud</description>
<!-- //// -->
<!-- ZK -->
<listener>
<description>
Used to cleanup when a session is destroyed
</description>
<display-name>ZK Session Cleaner</display-name>
<listener-class>
org.zkoss.zk.ui.http.HttpSessionListener
</listener-class>
</listener>
<servlet>
<description>ZK loader for evaluating ZK pages</description>
<servlet-name>zkLoader</servlet-name>
<servlet-class>
org.zkoss.zk.ui.http.DHtmlLayoutServlet
</servlet-class>
<!-- Must. Specifies URI of the update engine
(DHtmlUpdateServlet). -->
<init-param>
<param-name>update-uri</param-name>
<param-value>/zkau</param-value>
</init-param>
<load-on-startup>1</load-on-startup><!-- MUST -->
</servlet>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.zul</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>*.zhtml</url-pattern>
</servlet-mapping>
<servlet>
<description>The asynchronous update engine for ZK</description>
<servlet-name>auEngine</servlet-name>
<servlet-class>
org.zkoss.zk.au.http.DHtmlUpdateServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>auEngine</servlet-name>
<url-pattern>/zkau/*</url-pattern>
</servlet-mapping>
<!-- //// -->
<!-- Sakai request filter -->
<filter>
<filter-name>sakai.request</filter-name>
<filter-class>org.sakaiproject.util.RequestFilter</filter-class>
<!-- If you need to do uploads you will need this -->
<init-param>
<param-name>upload.enabled</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>sakai.request</filter-name>
<servlet-name>sakai.testezkcrud</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!-- Tool Servlet -->
<servlet>
<servlet-name>sakai.testezkcrud</servlet-name>
<servlet-class>
uk.ac.cam.caret.sakai.WebappToolServlet
</servlet-class>
<!-- use this to specify a starting page location if needed -->
<!--
<init-param>
<param-name>main-page</param-name>
<param-value>/</param-value>
</init-param>
-->
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Sakai listeners -->
<listener>
<listener-class>org.sakaiproject.util.ToolListener</listener-class>
</listener>
<listener>
<listener-class>org.sakaiproject.util.ContextLoaderListener</listener-class>
</listener>
<!-- MIME mapping -->
<mime-mapping>
<extension>gif</extension>
<mime-type>image/gif</mime-type>
</mime-mapping>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jad</extension>
<mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpeg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>js</extension>
<mime-type>application/x-javascript</mime-type>
</mime-mapping>
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>zhtml</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>zul</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<!-- define the starting page for this app -->
<welcome-file-list>
<welcome-file>HelloWorld.zul</welcome-file>
<welcome-file>HelloWorld.zhtml</welcome-file>
<welcome-file>HelloWorld.html</welcome-file>
<welcome-file>HelloWorld.htm</welcome-file>
<welcome-file>HelloWorld.jsp</welcome-file>
</welcome-file-list>
</web-app>
This web.xml has fewer listeners, filters and servlets than the web.xml from my JSF project created by Sakai. So I guess this might be the problem.
Thanks,
Cristiane Yaguinuma.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4836133
By: jebberwocky
Hey Cristiane
If it is possible, could you please mail me the project to jeffliu AT zkoss DOT org. I will give it a try.
thank you
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4837096
By: crisyag
Hello jebberwocky,
Again, thank you for your valuable help!
I will send you my project, please remember that it was automatically generated by Sakai Eclipse plugin, I've done just a few modifications in order to include ZK. As Sakai uses maven to build and deploy the project, the dependencies are described in project.xml files.
Cristiane Yaguinuma.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4923083
By: crisyag
Hello jebberwocky,
I think I found out what might be the problem. As I told in previous emails, Sakai defines filters and servlets. One of them, I still did not find which one, adds a parameter to the url, so the url is not mapped to auEngine servlet and consequently ajax requests do not work. In web.xml:
<servlet>
<description>The asynchronous update engine for ZK</description>
<servlet-name>auEngine</servlet-name>
<servlet-class>
org.zkoss.zk.au.http.DHtmlUpdateServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>auEngine</servlet-name>
<url-pattern>/zkau/*</url-pattern>
</servlet-mapping>
When I make an ajax request (e.g. click a button), the url is somehow modified by Sakai to something like /zkau?sakai.tool.placement=210983094801 and then it doesn't pass through auEngine and I get the message "The page or component you request is no longer available: g47m. This is normally caused by timeout, or opening too many web pages. You have to reload the page and try again".
I changed the url-pattern to <url-pattern>/zkau*</url-pattern>, but got the problem that desktop.dsp is not found. Probably I cannot remove the parameter, since it is used by Sakai.
Does someone have any idea of how to solve this problem? Need to solve it ASAP
Thank you very much,
Cristiane Yaguinuma.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4924162
By: crisyag
I took off the url parameter and the problem is still there... so please forget my last message
Sakai JSF filter does many response.sendRedirect(), so I was wondering if it could be the problem. I've read some messages in zk forum saying that when user clicks back button the same problem occurs. I put <meta http-equiv="Cache-Control"
content="no-cache,no-store,must-revalidate,max-age=0"/>
<meta http-equiv="Pragma" content="no-cache,no-store"/> in my jsp but no success
I also saw this thread
http://sourceforge.net/forum/forum.php?thread_id=1589251&forum_id=510209 that recommends to use GlobalDesktopCacheProvider, but I could not get it working.
Here is my log message:
SEVERE: Unable to load /WEB-INF/zk.xml
org.zkoss.zk.ui.UiException: Unable to load org.zkoss.zk.ui.sys.GlobalDesktopCacheProvider, at [SYS jndi:/localhost/sakai-testezkjsf-tool/WEB-INF/zk.xml line 40 col 18]
line 40 of zk.xml:
40 <system-config>
41 <cache-provider-class>org.zkoss.zk.ui.sys.GlobalDesktopCacheProvider</cache-
provider-class>
42 </system-config>
I hope that GlobalDesktopCacheProvider will solve my problem, as it happened to other message threads. But I am not sure if this will happen and, first of all, I need to get GlobalDesktopCacheProvider working.
Any ideas? Is there any other conf in order to use GlobalDesktopCacheProvider ?
Any help will be appreciated,
Cristiane Yaguinuma.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4928044
By: crisyag
I changed zk.xml to use org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider and it is working now!
Is there any more docs for GlobalDesktopCacheProvider? I would like to understand better what was the problem.
Thanks for the help,
Cristiane Yaguinuma.
Asked: 2008-03-11 20:19:27 +0800
Seen: 261 times
Last updated: Apr 25 '08