• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

reload a table from a selection drop down

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic