0

Zk + JSP

asked 2012-01-10 04:25:40 +0800

kumaryesu gravatar image kumaryesu
42

Can we integrate ZK in JSP?

I would like to develop a JSP project where i can use ZK. is it possible?

delete flag offensive retag edit

9 Replies

Sort by ยป oldest newest

answered 2012-01-10 06:41:34 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

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

link publish delete flag offensive edit

answered 2012-01-10 08:44:35 +0800

kumaryesu gravatar image kumaryesu
42

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?

link publish delete flag offensive edit

answered 2012-01-10 10:15:32 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

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

link publish delete flag offensive edit

answered 2012-01-10 11:09:23 +0800

kumaryesu gravatar image kumaryesu
42

updated 2012-01-10 11:15:53 +0800

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

link publish delete flag offensive edit

answered 2012-01-10 11:48:05 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

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>
 ...

link publish delete flag offensive edit

answered 2012-01-10 12:23:13 +0800

kumaryesu gravatar image kumaryesu
42

updated 2012-01-10 12:23:54 +0800

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

link publish delete flag offensive edit

answered 2012-01-10 13:40:39 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

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

link publish delete flag offensive edit

answered 2012-01-10 16:07:01 +0800

kumaryesu gravatar image kumaryesu
42

I am really greateful to you sir...
Thank you veryyyyyyyyyyyyyyyyyyyyyyy veryyyyyyyyyyyyyyyyyyyyyyyyyyyy much sir...
I got it. Thank you very much sir.....

Thank you very much sir...

link publish delete flag offensive edit

answered 2012-01-12 09:56:48 +0800

kumaryesu gravatar image kumaryesu
42

updated 2012-01-12 09:59:13 +0800

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..

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: 2012-01-10 04:25:40 +0800

Seen: 317 times

Last updated: Jan 12 '12

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