• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to open a JSP page inside another JSP page?

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there

I have two jsp page one is demo1.jsp and other is demo2.jsp

on a click of a particular link on demo1.jsp I want to opwn demo2.jsp inside demo1.jsp without changing layout of demo1.jsp

I tried to use <jsp;include />

but that doesn't work for me.

I don't have code know.But how to do this simply on a single link click on a big page?

Thanks
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, for a start you should use a colon and not a semicolon in jsp:include.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JSP include happens on the server before the page is even sent to the browser. You need to understand how JSP operates; please read this article to learn how JSPs work.

In order to include new elements into a page as the result of a client-side event -- such as a button or link click -- you should be using Ajax to fetch the HTML fragment (not full HTML page) from the server and insert it into the DOM. jQuery will help you do this with a single line of code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!