Two Laptop Bag*
The moose likes JSP and the fly likes jsp static include - no joy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp static include - no joy" Watch "jsp static include - no joy" New topic
Author

jsp static include - no joy

B Chandler
Greenhorn

Joined: Apr 02, 2005
Posts: 4
Hey guys,

wonder if you can help with this small problem...

trying to include a jspf frag in my main jsp (as a header), but it doesn't appear.

In my web-app structure, I have placed files in the following places:-

The jspf fragment (header) -> Gallery/WebRoot/WEB-INF/jspf/Header.jspf

The image called by the fragment -> Gallery/WebRoot/images/logo.gif

The main jsp that is trying to include the fragment ->
Gallery/WebRoot/jsp/adminForm.jsp


When I preview the header fragment in the IDE, the logo and text appear as intended, so I'm happy that the frag can find the logo.gif.
But the problem occurs when I use:



in the body of the main jsp. IDE shows no errors but the header content fails to materialise.

Does anyone know where I went wrong?
I read that frag files should be kept under WEB-INF/jspf and I know that files under WEB-INF can't be accessed directly, but it shouldn't affect internal access, should it?!

regards,
B

[ April 13, 2005: Message edited by: B Chandler ]
[ April 13, 2005: Message edited by: B Chandler ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Did you try:

?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
B Chandler
Greenhorn

Joined: Apr 02, 2005
Posts: 4
Hi Ben,

I tried your suggestion.... no errors (that's good), but still no header content I'm afraid.

I thought I'd need to walk up a directory from the location of the jsp?

I used:

in the frag file in order to locate logo.gif and don't understand why the same principle doesn't allow the jsp to locate header.jspf.

This is my first attempt at JSP and I'm also new to the myEclipse IDE so I can't rule out general config error.
B
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Have you right clicked on the images and read the properties to see where the browser is looking for them?

Remember they're going to be relative to the URL that shows up in the browser's address window, not where the include lives.
The browser doesn't know anything about server side includes.

<img src="images/myImage.gif" />
B Chandler
Greenhorn

Joined: Apr 02, 2005
Posts: 4
Ben,

good point, well put!

We're up and running now, cheers mate

regards, B
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp static include - no joy