-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Can we integrate ZK in JSP?
I would like to develop a JSP project where i can use ZK. is it possible?
Hi,
yes, that's possible. You can either use ZK-JSP or integrate ZUL-files into your existing JSP templates via simple request dispatching. The ZK-based Jease-Content-Management-System does it this way and it works nicely. Here's a demo:
http://www.jease.org/demo/zul/
The page template is a simple JSP whereas the ZUL-Script is integrated via something like
... jsp-stuff ... <% pageContext.include("/path/to/your/custom.zul"); %> ... jsp-stuff ...
HTH, Maik
Thank you sir.
I tired what you told me. only the label and button are displayed when use this code (<% pageContext.include("/path/to/your/custom.zul"); %>)
textbox and other components of zk are not displyed. and also i am getting the same format of zk file in jsp when i integrate
can you pls give me some sample program in jsp?
Make sure that your JSP uses the correct DOCTYPE (XHTML/Transitional) for ZK-Integration:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
HTH, Maik
Sorry sir. i still have the same problem.
This is my index.jsp file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <body> <h1>B08MAD.in Home Page</h1> <% pageContext.include("index1.zul"); %> </body> </html>
and this is my uploadFiles.zul file
<?page title="Uploading" contentType="text/html;charset=UTF-8"?> <zk> <window id="uploadFiles" title="Uploads" border="normal" width="400px" closable="true" mode="modal" apply="" visible="false"> <grid> <columns> <column width="20%" /> <column width="80%" /> </columns> <rows> <row spans="2" align="center"> <label value="Max Upload size is 10 MB" id="error" style="color: red; font-weight:bold;" /> </row> <row height="40px" id="rowCategory"> <label value="Category" /> <combobox id="category" width="40%" readonly="true"> <comboitem label="Event" /> <comboitem label="News" /> <comboitem label="Jobs" /> <comboitem label="Images" /> <comboitem label="Banner" /> </combobox> </row> </rows> </grid> </window> </zk>
this is my URL : http://www.b08mad.in/
i could not get ZUL file..
only JSP file is running..
pls don't get me wrong if i ask any wrong question.
i am learning ZK Frmework..
pls provide me some sample code if you could....
thanks for answering me
Did you properly configure ZK/ZUL-support in your web.xml? You need also to deploy the zk.jars to WEB-INF/lib of your application.
... <servlet> <servlet-name>zkLoader</servlet-name> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <init-param> <param-name>update-uri</param-name> <param-value>/zkau</param-value> </init-param> <load-on-startup>1</load-on-startup> </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> <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> <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> <welcome-file-list> <welcome-file>index.zul</welcome-file> <welcome-file>index.zhtml</welcome-file> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> ...
I have configured the web.zml file as bellow
<servlet> <servlet-name>zkLoader</servlet-name> <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> <init-param> <param-name>update-uri</param-name> <param-value>/zkau</param-value> </init-param> <load-on-startup>1</load-on-startup> </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> <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> <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> <welcome-file-list> <welcome-file>index.zul</welcome-file> <welcome-file>index.zhtml</welcome-file> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>
But i have the same proble
Works for me:
http://www.jease.org/tst/test.jsp
But you need to change your ZUL-file from
... <window ... visible="false"> ...
to
... <window ... visible="true"> ...
If it doesn't work for you this way, I recommend to download the Jease distribution which contains a war-file with all the configs/libraries properly configured.
HTH, Maik
Hai Sir,
Again i have problem. when i remove the web.xml file the following code works correctely
index.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Index</title> <!-- initialize the TN3 when the DOM is ready --> </head> <body> <center> <% pageContext.include("/uploadFiles.zul"); %> </center> </body> </html>
and my uploadFiles.zul
<?page title="Adding New Student" contentType="text/html;charset=UTF-8"?> <zk> <window id="uploadFiles" title="Uploads" border="normal" width="400px" height="500px" closable="true" mode="modal" apply="" visible="true"> Why is not working...!!! </window> </zk>
my website URL is http://www.b08mad.in/
its not working
but when i remove the web-inf folder it works. but label is shown. textbox, button etc... are not shwoing
pls help me sir !!!
thanks in advance..
Asked: 2012-01-10 04:25:40 +0800
Seen: 317 times
Last updated: Jan 12 '12