File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes jsp:include not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:include not working" Watch "jsp:include not working" New topic
Author

jsp:include not working

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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?


GenRocket - Experts at Building Test Data
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
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


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, I changed it to false, but still get the same results. Thanks anyway.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Gregg, is the url you are providing to the include context-relative?
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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

Joined: Jan 10, 2002
Posts: 60822
    
  65

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

Joined: Jan 10, 2002
Posts: 60822
    
  65

In other words, try

if holocron_struts is your context.
bear
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

yes, holocron_struts is my context path. I'll give it a shot. Thanks.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Worked out great Bear! Thanks a bunch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:include not working
 
Similar Threads
Struts redirect tag
tiles definition problem
Problem with logic and bean tag
Legal to put a bean:write inside tiles-defs.xml?
struts problem