• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:include not working

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a very simple index.jsp page that looks like this:

And my main_header.jsp looks like this:

When I go to index.jsp I get no erros, and I get a blank screen. When I view source, I see the HTML from index.jsp, but nothing from main_header.jsp. Am I doing something wrong?
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am not wrong... But not very sure... U specify the flush attribute to be "true", which means that the output of the current page is sent to the user before the output of the included page is done... U can see the details about the attributes of jsp:include in the following link to JSP syntax reference...
http://java.sun.com/products/jsp/syntax/1.2/syntaxref1214.html
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I changed it to false, but still get the same results. Thanks anyway.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65125
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg, is the url you are providing to the include context-relative?
bear
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was just getting ready to post before you responded Bear. I changed the URL to be relative to what page I am on..
So what I had became:
<jsp:include page="includes/main_header.jsp" flush="true"/>
And it worked.
So is there any way I can make the URL absolute to my Context? So I am stuck doing things like ../../includes/main_header.jsp in other pages? I would rather just do /holocron_struts/includes/main_header.jsp on every page I need it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65125
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is holocron_struts your context path or a folder within the context?
If it's your context path, leave it off as a context-relative url doesn't include the path name itself.
bear
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65125
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In other words, try

if holocron_struts is your context.
bear
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, holocron_struts is my context path. I'll give it a shot. Thanks.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Worked out great Bear! Thanks a bunch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic