0

Include tag does not display Servlet output

asked 2010-10-17 21:48:34 +0800

meetahilan gravatar image meetahilan
3

Hello All,
I am new to ZKoss. We are evaluating the framework to build our portal and I am in the process of evaluating the framework. We have a requirement to display an external web page content in our portal without using Iframe (in order to have more control over the displayed data). In order to implement this , I wrote a zul file that invokes a servlet called HtmlProcessor as shown below

Hello.zul
********
<window title="My First window" border="normal" width="200px">
<include mode="auto" src="/HttpProcessor"></include>

</window>

The servlet does nothing but get the yahoo.com webpage and write it to response as shown below.

HttpProcessor Servlet code
************************

try {
URL yahoo = new URL("http://www.optisolbusiness.com/");
URLConnection yahooConnection = yahoo.openConnection();
DataInputStream dis = new DataInputStream(yahooConnection.getInputStream());
String inputLine;
StringBuffer sb = new StringBuffer();
BufferedReader br = new BufferedReader(new InputStreamReader(dis));


while ((inputLine = br.readLine()) != null) {
sb.append(inputLine);
}
dis.close();
response.getWriter().print(sb.toString());
response.flushBuffer();

} catch (MalformedURLException me) {
System.out.println("MalformedURLException: " + me);
} catch (IOException ioe) {
System.out.println("IOException: " + ioe);
}


When I call the servlet directly from the browser everything seems good, I see the home page of Yahoo rendered in my browser. But when call the Hello.zul, the file displayes processing msg and stays there for ever. I also tried storing the yahoo home page in local drive and included <![CDATA[ around the html and read the contents through the servlet. No luck. The browser displayes the processing msg and stays there for ever.
I am stuck at this point, and any pointers on this will be highly useful.


Thank you,
AP

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2010-10-20 09:20:32 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Hi,

I think you still need to use an iframe instead. Because yahoo has its own JS and CSS files, and they may conflict the main page.

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: 2010-10-17 21:48:34 +0800

Seen: 202 times

Last updated: Oct 20 '10

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