How can I embed a web page in a screen using isCOBOL Web Direct 2.0?
Estimated Reading Time: 1 MinutesThe solution for this is to include a ZK iFrame JavaBean control in your application.
Because isCOBOL WD2 works with the ZK package it is very natural to interact with the JavaBean control.
The following sample shows how to include the JavaBean control in the screen section and the related Java class in the repository paragraph of the configuration section. It also shows how to define the related object in the working-storage and what method to invoke in order to specify the URL.
program-id. iframesample.
configuration section.
repository.
class iscobol-java-bean
as "com.iscobol.gui.server.CobolGUIJavaBean"
.
working-storage section.
77 crt-status special-names crt status pic 9(5).
77 wb object reference iscobol-java-bean.
screen section.
01 screen1.
03 push-button
line 2
col 2, size 20 cells
exception-value 100
title "Go to Veryant.com"
.
03 java-bean
clsid "org.zkoss.zul.Iframe"
line 5
col 2
lines 45, size 90
object wb
.
procedure division.
main.
display standard graphical window
lines 50, size 100.
display screen1.
perform until crt-status = 27
accept screen1
on exception
continue
end-accept
if crt-status = 100
wb:>callMethod ("setSrc", "http://www.veryant.com")
end-if
end-perform.
stop run.