aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes load the response of another jsp page in my current jsp page using AJAX. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "load the response of another jsp page in my current jsp page using AJAX." Watch "load the response of another jsp page in my current jsp page using AJAX." New topic
Author

load the response of another jsp page in my current jsp page using AJAX.

nikki sinha
Greenhorn

Joined: Jul 04, 2012
Posts: 14
hi,

i want to load the response of another jsp page in my current jsp page using AJAX.

i have a jsp page home.jsp which currently shows 4 static images inside a table, what i want is when the user clicks on the next button, he should stay on the page but the images in the table should be replaced by other 4 images. i have another jsp called page1.jsp which stores the next 4 images.
In home.jsp i want to call an AJAX function when the user clicks the button next, that AJAX function should get response from the page1.jsp and replace the first four images with the response of page1.jsp.

please help..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

You don't need to do anything with another JSP page, or even with Ajax. Simply replace the src value of the image elements with the URL of the new images to be displayed. Don't make it any more complicated than it needs to be.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
nikki sinha
Greenhorn

Joined: Jul 04, 2012
Posts: 14
Bear Bibeault wrote:You don't need to do anything with another JSP page, or even with Ajax. Simply replace the src value of the image elements with the URL of the new images to be displayed. Don't make it any more complicated than it needs to be.


thankyou for the reply, but my images are stored in database, and thats why i want to use another jsp for this purpose because on home.jsp there are other textfields also. and i dont want to reload the page to display the other set of images.. that is the reason i want to use AJAX so that i dont have to reload and the images can change on the click of nutton
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 296
    
    5

It doesn't matter where the images are stored, in your pages they are still <img> elements with src attributes. You can change the value of the src attributes on the click of a button.


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
 
 
subject: load the response of another jsp page in my current jsp page using AJAX.