0

How do I integrate existed JSP with ZK?

asked 2006-07-10 01:44:04 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3814163

By: nobody

I'm new to ZK and web programming.
And I need to enrich my JSP file by ZK UI.
for example I have a jsp file like this:
<code>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+
path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'MyJsp.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>

<body>
This is my JSP page. <br>
It is <%=new Date()%> now.
</body>
</html>
</code>

Then I add fileter in Tomcat web.xml:
<code>
<filter>
<filter-name>zkFilter</filter-name>
<filter-class>com.potix.zk.ui.http.DHtmlLayoutFilter</filter-class>
<init-param>
<param-name>extension</param-name>
<param-value>html</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>zkFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
</code>
But when I browse this local jsp page, the error message displays as below:
<br/>
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

com.potix.zk.ui.UiException: org.xml.sax.SAXParseException: White space is required between the public identifier and the system identifier.
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
com.potix.lang.Classes.newInstance(Classes.java:79)
com.potix.lang.Exceptions.wrap(Exceptions.java:162)
com.potix.zk.ui.UiException$Aide.wrap(UiException.java:46)
com.potix.zk.ui.metainfo.PageDefinitions.getPageDefinitionDirectly(PageDefiniti
ons.java:75)
com.potix.zk.ui.metainfo.PageDefinitions.getPageDefinitionDirectly(PageDefiniti
ons.java:52)
com.potix.zk.ui.impl.UiFactoryImpl.getPageDefinitionDirectly(UiFactoryImpl.java
:63)
com.potix.zk.ui.http.DHtmlLayoutFilter.process(DHtmlLayoutFilter.java:91)
com.potix.zk.ui.http.DHtmlLayoutFilter.doFilter(DHtmlLayoutFilter.java:110)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

It tooks me a lot of time finding the solution but all in vain...anyone could help me? thanks!


delete flag offensive retag edit

13 Replies

Sort by ยป oldest newest

answered 2006-07-10 02:02:49 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3814170

By: henrichen

The filter assumes XML pages (zul or xhtml). I think the problem is at the line of DOCTYPE. Search the forum, I remember that someone hit this issue before and he mentioned how they solved it.

/henri

link publish delete flag offensive edit

answered 2006-07-10 06:14:45 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3814326

By: ahwaysie

Hi Henri,
I don't understand what you mean about the problem of DOCTYPE.I set it:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> is it wrong?
My jsp files are all set this DOCTYPE.
I also search keyword "JSP" within the forum.I found this one has the similar problem with me.https://sourceforge.net/forum/message.php?msg_id=3641486
But he said the problem is "Tomcat not support mapping chain very well".
Even if I try to modified the the <url-pattern>, set it mapping to the target file or "/*". DHtmlLayoutFilter still can't parse my ZUL in this JSP file. what can I do further?

link publish delete flag offensive edit

answered 2006-07-10 06:57:50 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3814354

By: henrichen

Please take a look of this:

http://sourceforge.net/forum/message.php?msg_id=3797981

/henri

link publish delete flag offensive edit

answered 2006-12-12 14:36:28 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4055768

By: kapilborkar

how to use zk tag in my jsp page..


link publish delete flag offensive edit

answered 2006-12-14 05:07:33 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4059659

By: henrichen

Please see ZK's smalltalks.

1. Work with Legacy Web Applications, Part I - Servlets and Forms http://www.zkoss.org/smalltalks/legacy-form/legacy-form.html

2. Work with Legacy Web Applications, Part II - JSP http://www.zkoss.org/smalltalks/legacy-jsp/legacy-jsp.html

3. Work with Legacy Web Applications, Part III - Validate Forms http://www.zkoss.org/smalltalks/legacy-validate/legacy-validate.html

/henri

link publish delete flag offensive edit

answered 2007-04-17 01:04:14 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4264686

By: jumperchen

Please check whether your file is well-formed if you want to use DHtmlLayoutFilter to integrate ZK and JSP.

Try to use the following legal code.

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>JSP Page</title> </head> <body> <c:forEach begin="1" end="2"> SOME TEXT <br /> </c:forEach> </body> </html>

Jumper

link publish delete flag offensive edit

answered 2007-04-17 12:26:57 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4265430

By: westpine

Ok, thanks! But,oh... It will kill me... :-) Now I'm trying to use zscript.
It doesn't recognize it as script. I added

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:x="http://www.zkoss.org/2005/zul"
xmlns:zk="http://www.zkoss.org/2005/zk">
then

<zk:zscript>
import com.eco_iumk.JournalManager;
import com.eco_iumk.t_user_detail;
import com.eco_iumk.t_user2topic;
import com.eco_iumk.DBConnector;
JournalManager jm = new JournalManager();
......and so on....
</zk:script>

But content of script "import blabla..." shown as text on the page and was not recofnized as script. How to fix it?


link publish delete flag offensive edit

answered 2007-04-17 13:40:51 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4265585

By: jumperchen

Try:
<zscript>
...
</zscript>

BTW, I had posted a bug(like above sample) to bugs-list as follows,
http://sourceforge.net/tracker/index.php?func=detail&aid=1702216&group_id=152762
&atid=785191

Jumper

link publish delete flag offensive edit

answered 2007-04-17 13:54:16 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4265617

By: westpine

<zscript> doesn't work either :-(

link publish delete flag offensive edit

answered 2007-04-17 14:07:02 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4265643

By: waterbottle

hi, westpine,
I didn't directly use zk/zul tag in .jsp file, but I use include tag to .zhtml files in jsp.
It's work for me.




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: 2006-07-10 01:44:04 +0800

Seen: 521 times

Last updated: Apr 18 '07

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