-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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.
Asked: 2010-10-17 21:48:34 +0800
Seen: 202 times
Last updated: Oct 20 '10