I need to display the multiple images onload which are stored in the server , the database contains the filepath and filename .the servlet would query the sql server to get the filenames.
i need to do that on home.jsp .
when i use the below code browser shows onLoadDisplayImages as url , i want to use it using ajax and should stay in home.jsp . please help.
<script language="javascript">
function OnStartup(){
var url = "onLoadDisplayImages";
document.location.href='onLoadDisplayImages';
}
window.onload = OnStartup;
</script>
onLoadDisplayImages is servlet which just returns the filename .
below is the code
String imageUrl = "images/siguptop.JPG";
response.setContentType("text/plain");
response.getWriter().write(imageUrl);
Use Ajax to load your images. http://api.jquery.com/jQuery.get/