• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reload a table from a selection drop down

 
Danne Girow
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey! This is probably something really simple but I have spent waaayyy to much time on and can't see the solution at the moment.

I am including a jsp page inside of another jsp page. The include page has a warehouse selection box and a table. The table is initially loaded with all warehouse values. When the warehouse selection box changes I need to reload the table. I have an onchange on the selection box which goes into a javascript. I put a form.reload() in it but nothing happens. When I do a onchange form.submit() I get a generic error message. I just want to reload the include portion of the page not the whole form. Can someone please give me an idea as to how to do this?

Thanks for the help!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP includes on the server have little to do with what happens on the client. Despite how you may construct the page on the server, a single HTML page is delivered to the browser and any details about what was a JSP include or not is completely gone.

So there is no concept of only refreshing the included part.

You either need to reload the entire page, or get tricky with Ajax and manipluate the DOM of the loaded page.

(Or resort to using iframes).
 
Danne Girow
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I sort of have the reload working now...I say sort of because I am able to reload the page but I can't seem to get the page to reload based on the selection box. Any ideas/suggestions/thoughts? Is there an easier way to do this?

Here is the selection code:
<code>
Warehouse:

<select name="selwarehouse" id="whses" style="width: 225px;" onChange="autoReloadPage(document.showWhs.selwarehouse.value)" >

<option value="ALL" selected="selected"> Select A Specific Warehouse </option>
<% for(int i = 0; i != whs.getWhsCount(); i++){
%>
<option value="<%= whs.getWhs(i)%>"><%= whs.getWhs(i)%> - <%= whs.getDesc(i)%></option>
<% } %>
</select>

</CODE>

The Java scriptlet code for this is (yes I realize that the autoReloadPage is a waste but it works):

<code>
function autoReloadPage(whs) {
alert("Inside autoreload submit button ===> whs " + whs);
document.showWhs.warehouse.value = whs;
prepSubmit(2, '');

}

function prepSubmit(type, style) {
alert("Inside prepSubmit(): type = " + type + " style = " + style);
if ((internalSubmitButtonLoading == 0) &&
(internalRefreshLinkReloading == 0) &&
(internalAutoReloading == 0) &&
(externalLinkLoading == 0)) {
handleMatrix = document.getElementById('matrixTable');
if (handleMatrix) handleMatrix.style.display = 'none';
handleAnim = document.getElementById('loadingAnim');
if (handleAnim) handleAnim.style.display = 'block';
handleWarning = document.getElementById('reloadWarning');
if (handleWarning) handleWarning.style.display = 'inline';
switch (type) {
case 0:
internalSubmitButtonLoading = 1;
if (handleWarning) handleWarning.innerHTML = 'Matrix is loading...';
break;
case 1:
internalRefreshLinkReloading = 1;
if (handleWarning) handleWarning.innerHTML = 'Matrix is refreshing...';
setTimeout("self.location.reload(true)",100);
break;
case 2:
internalAutoReloading = 1;
if (handleWarning) handleWarning.innerHTML = 'Matrix is refreshing...';
setTimeout("self.location.reload(true)",100);
break;
case 3:
externalLinkLoading = 1;
if (handleWarning) handleWarning.innerHTML = 'Matrix is loading ' + style + '...';
break;
}

handleSubmitButton = document.getElementById('submitButton');
if (handleSubmitButton) handleSubmitButton.disabled = true;
return true;
}
}
</code>

Thanks for the help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic