| Author |
How to call jsp pages from java script function
|
A Chauhan
Greenhorn
Joined: Nov 21, 2006
Posts: 15
|
|
Hi, I've a Jsp page which is having radio buttons.Upon clicking one radio button,it should include(display result inthe same page)a jsp page and upon clicking another radio button it should include another jsp file in the same area. I don't know how to place "<jsp:include file="somefile.jsp"/>" using Javascript
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by amrish jain: I don't know how to place "<jsp:include file="somefile.jsp"/>" using Javascript
You can't. Javascript is interpreted in the browser, on the client's machine, after the JSP has finished building the page and has sent it from the server to the client. In other words, by the time the Javascript interpreter starts parsing your page, the JSP is finshed, gone, and no longer in the picture. I'm going to move this thread to our HTML/Javascript forum. What you want to do could be achieved with Ajax and that would be the forum for Ajax discussions.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
You could this one of two ways: 1) Use an iframe into which you load the "sub-page" upon a click of the radio button. 2) Use Ajax to fetch the page fragment to display and put in into a portion of the main page reserved to display it. If you already have the sub-pages coded as full HTML pages, option 1 is probably the easiest course.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: How to call jsp pages from java script function
|
|
|