日期:2014-05-18  浏览次数:20636 次

JSP页面多线程和进度条的问题!
小弟最近碰到这个问题了,请指点下!
问题描述:
        从前一个JSP页面传很多参数过来,在当前JSP页面拿到参数之后,开始处理(这个过程很长,有时数据多可能上1个小时),目前是直接在当前页面处理的,时间一长,页面老是死掉,没有任何的信息,IE加载的进度条只有5格就永远不动了!
        现在想做成这样的:当前JSP页面拿到参数之后,把费时的操作放到另一个JSP页面(这个大操作不单单是一个java方法,用到了一套自定义标签,所以只能放在jsp页面里做),而当前的页面则显示一个进度条,从处理大操作的JSP页面获取信息。请教如何实现?!因为这个操作有牵扯标签,所以我的理解是一定要放在jsp页面里做,这样就不知道怎么用多线程,要是单纯的java方法的话,倒还可以试着实现~~~~~~~高人请指点一下,或有什么好的建议,不甚感激!

------解决方案--------------------
正在研究
------解决方案--------------------
可以用ajax技术处理,每隔一段时间提交一次,返回进度值
------解决方案--------------------
别用jsp做逻辑处理
------解决方案--------------------
写servlet
处理都放在里面
至于进度条放在提交页面,用js

showLoadingBar();
如下:
/*
*在表单form提交前,调用showLoadingBar(),灰显表单页面,显示请等待信息。
*/

function showLoadingBar(){
var Br = new innerMessageBox();
Br.ShowModal( 250, 30);
}
function innerMessageBox(){
var BackObject, FormObject;

// 检查页面中是否存在该控件.
function checkIMBObject(){
if (document.getElementById( "imb_Background ")==null && document.getElementById( "imb_FormModal ")==null){
document.body.innerHTML += " <iframe id=\ "imb_Background\ " src=\ "about:blank\ " style=\ "position:absolute;left:0;top:0;width:0px;height:0px;visibility:hidden; \ " frameborder=no border=0> </iframe> "
+ "\r\n <iframe id=\ "imb_FormModal\ " src=\ "about:blank\ " style=\ "position:absolute;left:0;top:0;width:0px;height:0px;visibility:hidden;border-style:solid;border-width:1px; border-color:#3399FF\ " frameborder=\ "0\ " > </iframe> ";
window.imb_Background.document.open();
window.imb_Background.document.write( " <html> </html> ");
window.imb_Background.document.close();
window.imb_FormModal.document.open();
window.imb_FormModal.document.write( " <html> ");
window.imb_FormModal.document.write( " <head> </head> ");
window.imb_FormModal.document.write( " <body style=\ "position:absolute;padding:7px 9px 2px 50px\ " scroll=\ "no\ " leftmargin=0 topmargin=0 style=\ "background-color:#FFFFCC; font-size: 9pt; font-FAMILY: \ "宋体\ ";\ "> ");
window.imb_FormModal.document.write( " <tr> <td> ");
window.imb_FormModal.document.write( " <img src=\ "/corporbank/images/loading.gif\ " align=\ "absmiddle\ "/> ");
window.imb_FormModal.document.write( "&nbsp;交易處理中,請稍候。…… ");
window.imb_FormModal.document.write( " </td> </tr> ");
window.imb_FormModal.document.write( " </body> ");
window.imb_FormModal.document.write( " </html> ");
window.imb_FormModal.document.close();
}
}

// 显示对话框控件.
this.ShowModal = function( iWidth, iHeight){
var smWidth = 250, smHeight = 30, smObject, smAlpha = 0, smInterval;
if (arguments.length > 4 ){
smWidth = iWidth;
smHeight = iHeight;
}
// 背景的渐显.
function checkIMBAlpha(){
smObject.style.filter = "alpha(opacity= "+smAlpha+ "); ";