jsp populate a listbox without blocking the user (iframe?)

V

vulkanino

Hi all,

I have a problem with my project. I have a JSP page that must do some
background database processing, let's say some lengthy operation. The
database operations are done using a java bean. I don't want to show
the user a "wait please" message that could stay there for a long
time. I'd rather like to show a list box on the page, that is
populated with strings coming from the bean, to inform the user what
is going on.

I have done that using an IFRAME, which uses the java bean to do the
row-by-row operations and populates the list in the "father" page.
That works fine, but if an execption is thrown in the iframe, the
error is shown in the iframe itself, which has a size of zero. I can
even make the iframe bigger but the error doesn't come in the whole
page.

Is there a clean way to do that?
I've also used javascript to populate the list box, which I don't like
(browsers compatibility problems?).

How can I have the container page show and update its listbox, without
blocking?
Is the IFRAME the only method?
If I use the IFRAME, how can I "redirect" the errorpage to the caller
and not in the IFRAME?

Please help, I'm having headaches!
Thank you.

Here is the code:

[...]
-- controller.jsp
<%@ page errorPage="ErrorPage.jsp" %>
[...]
<FORM name="container" id="container" method="post" >
<SELECT size="15" name="output" id="output">
<OPTION value="0">messages</OPTION>
</SELECT>
</FORM>

<IFRAME
id="controller"
name="controller"
src="iframe.jsp"
align="top"
scrolling="no"
width="0px"
height="0px"
frameborder="0">
</IFRAME>
[...]

then in the iframe.jsp:
-- iframe.jsp

<%@ page errorPage="ErrorPage.jsp" %>
<jsp:useBean id="lsf" scope="page"
class="com.siae.corrispettivi.LoadSingleFile" />

[...]
<SCRIPT type="text/javascript">
var list = parent.document.getElementById("container").output;
var i = 0;
list = new Option("loading starts", i++, false, true);
<%
String out_string;
while ( lsf.hasElements() )
{
out_string = lsf.ReadLine();
%>
list = new Option("<%= out_string %>", i++, false, true);
<%
}
</SCRIPT>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top