• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to populate a jsp inside a jsp

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using jsp tag libs and have a requirement that on click of an image button that button should be replaced by a separate jsp which is included in current jsp
and with in same page contents of that jsp should come
but I am facing problem as how can I invoke <jsp:include> directive on click of a button
Can any one pls give me suggestion?
Thanks in advance
 
rahul V kumar
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using IFrames?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but I am facing problem as how can I invoke <jsp:include> directive on click of a button

You can't - the button is on the user side and jsp:include is on the server side.
Perhaps you can keep the included jsp output invisible until the button is clicked using JavaScript.
Bill
[ September 25, 2004: Message edited by: William Brogden ]
 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got the answer we have to refresh jsp on click of button and while refreshing it we put some flag which if true can allow the jsp:include to become active
correct me if i am mwrong
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd bet you could figure out doing it that way. You might also be able to figure out how to do it on the client side with JavaScript and/or DHTML.
 
Sanjeev Kaushik
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method you have thought is correct one. Use the flag to include another JSP.
Another method, to include the JSP content at the very start when this page is loaded, but keep in a hidden div. You can show these contents on the click of that button.

but the first method appears better if the contents/processing on server side for the included JSP is heavy. If it is very small, send one is better, it will aviod the network traffic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic