-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello, I'm trying to configure zk with JSF. The version of zk is 3.5.2, with zk JSF component 2.0 and myfaces 1.2.5
The jsf page is like the following:
<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <%@ taglib uri="http://www.zkoss.org/jsf/zul" prefix="z"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <f:view> <z:page> <z:window title="HelloWorld!"> <z:textbox id="t1" f:value="#{JpaResourceBean.value}"/> <h:inputText value="#{JpaResourceBean.value}"/> </z:window> </z:page> </f:view> </body> </html>
When running, z:textbox always displays ValueExpression[#{JpaResourceBean.value}]
but h:inputText renders correct value.
The following is my web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <context-param> <param-name>com.sun.faces.verifyObjects</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>com.sun.faces.validateXml</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <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> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <description>ZK loader for ZUML 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). 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> <!-- Optional. Specifies the default log level: OFF, ERROR, WARNING, INFO, DEBUG and FINER. If not specified, the system default is used. <init-param> <param-name>log-level</param-name> <param-value>OFF</param-value> </init-param> --> <load-on-startup>1</load-on-startup><!-- Must --> </servlet> <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>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <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-mapping> <servlet-name>zkLoader</servlet-name> <url-pattern>/zk/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>auEngine</servlet-name> <url-pattern>/zkau/*</url-pattern> </servlet-mapping> <!-- ZULJSF , Optional. Uncomment it if you never acces faces bean in zul component To access faces bean , use org.zkoss.jsf.zul.util.ContextUtil.getBean(beanName:String); --> <filter> <filter-name>ZK FacesContext Filter</filter-name> <filter-class> org.zkoss.jsf.zul.util.HttpFacesContextFilter </filter-class> <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> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>faces/welcomeJSF.jsp</welcome-file> </welcome-file-list> </web-app>
Is there anything wrong in my configuration?
Thanks!
Oops......
Yes, <z:textbox id="t1" f:value="${JpaResourceBean.value}"/>
produces correct result.
However, since standard JSF components requires #{JpaResourceBean.value},
the syntax used by zk JSF components seems confusing.
Furthermore, the official example and tutorial use #{......} syntax, it seems
a correction is needed.
Oops again......
Although <z:textbox id="t1" f:value="${JpaResourceBean.value}"/> may render correct result,
it appears that the textbox is not actually bound to JpaResourceBean.value, since update
will have no effect.
So, there must be problem in my configuration, but I don't know how to correct it.
Any suggestion is appreciated, thanks!
What is the error message whenr running glassfish,
Please check your jsf configuration/jar in web application and application server, I guess some runtime are embedded in some application server.
Hello, dennis:
The most problem is, there is no error message at all when running glassfish.
Moreover, when testing with tomcat, I used exactly the same JSF jar files (I copied
Sun's JSF RI from glassfish to tomcat).
Is there any other possibilities I could try?
thanks!
In my experience, use ZK to develop a web application is easier/faster then use JSF (JSF Spec./Runtime is too complex).
ZK JSF use wrapping mechanism to integrate ZK with JSF life cycle. there are too many environment issues to solve in JSF in different runtime I think.
why don't you just use ZK?
Hello, Dennis:
thanks for your suggestion.
And yes, it seems use data binding of ZK alone is simpler and more reasonable.
By the way, what's your opinion about zk + spring web flow?
I'm now trying to use spring web flow to control logical flow and zk for presentation and data binding.
This architecture appears quite clean and attractive.
Hi, Lendel, In My personal comment,
ZK provide several MVC features in past of year, it make do MVC and integrate with spring easier.
if you have good system desing and has well desing documents of your project, it is more convenient to do MVC with such feature with spring bean/webflow.
but, if your system is developing without any document(for a fast developing?XP?) I think is will make system hard to maintain(for example, to fine where is the controller , where is the next page).
Asked: 2009-01-17 15:31:42 +0800
Seen: 282 times
Last updated: Feb 02 '09