<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打開>
<input name=Button onClick=document.all.WebBrowser.ExecWB(2,1) type=button value=關(guān)閉所有>
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存為>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=直接打印>
<input name=Button onClick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印預(yù)覽>
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=頁面設(shè)置>
<input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=屬性>
<input name=Button onClick=document.all.WebBrowser.ExecWB(17,1) type=button value=全選>
<input name=Button onClick=document.all.WebBrowser.ExecWB(22,1) type=button value=刷新>
<input name=Button onClick=document.all.WebBrowser.ExecWB(45,1) type=button value=關(guān)閉>
再jsp頁面中寫入如下代碼:
<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>

<input type=button value=<s:text name="message.printing"/> onclick=document.all.WebBrowser.ExecWB(6,6)>
<input type=button value=<s:text name="message.pagesetup"/> onclick=document.all.WebBrowser.ExecWB(8,1)>
<input type=button value=<s:text name="message.printview"/> onclick=document.all.WebBrowser.ExecWB(7,1)>
可以再頁面上實現(xiàn)三個按鈕,“直接打印”、“頁面設(shè)置”、“打印預(yù)覽”,點擊三個按鈕能夠執(zhí)行相應(yīng)操作