Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

erratic jspf behaviour  RSS feed

 
Dave Brown
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I decided since I use the same page header on a handfull of jsp's to use jspf . I created a directory under WEB-INF called jspf to put the header in.
In each of my pages that uses the header I added

<%@include file="/WEB-INF/jspf/pageheader.jsp" %>

Now initially netbeans moans that the file is not found but the project still built with success so I did a quick test and sure enough an exception claiming it cant be found but if I do a refresh on the browser, it appears.. refresh again and it gives the exception.. and so on..

Seems odd why it works and then doesnt work, works and doesnt work. Can anyone shed any light on this. I dont think I need anything in web.xml for a jsp to use <%include do I ?

thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you need do nothing. And I've never heard of any problem similar to this. My guess is that it's a netbeans issue.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried running it in a freestanding instance of Tomcat (without netbeans)?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, the convention is to name files to be included with the include directive (fragment files) with a "jspf" extension.
One reason for this is that the files, on their own, may or may not compile and having them in the project can screw up the JSP engine when pre-compiling JSPs. The pre-compiler will ignore any files that don't have a "jsp" extension.

I don't know if NetBeans tries to pre-compile JSPs when you build the project or not but it never hurts to follow conventions.
 
Dave Brown
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!