Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JSP or JSPF  RSS feed

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am having a JSP, and in my JSP i have to include some part of code, actually i have around 20 JSPs and in all the 20 JSPs i have to include some common code, so what i have done is i have made another JSP and included it in the main JSP, Here am not sure whether to the extension of the included JSP should be .jsp or .jspf.
Can any one please explain what is the difference between the two extensions and what i have to use in the above mentioned scenario.
The knowledge i have is if it is .jsp means server creates _Jsp.java and a corresponding class file for that, please let me know which is better to use and why!
 
Sheriff
Posts: 67261
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally, .jspf is used for JSP fragments that are included via the static include directive. JSP files included via the standard include action are processed as their own page and are given the type .jsp.
 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear.
Can you please explain when do we use standard include action (<jsp:include page=""/>) and when do we use the static include directive (<%@ include file=""%>)
 
Bear Bibeault
Sheriff
Posts: 67261
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally, you use the directive to include fragments, which may or may not be complete and parsable JSP files. For example, a prelude that contains taglib directives that you are going to use on all pages (see below for caveat). These includes happen before translation.

The standard action is used to include complete and separately parsable JSP pages at run-time.

That said, I rarely use either anymore. I use a prelude defined in the deployment descriptor to prefix all pages with common directives, and custom actions or tag files to share common code.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Bear,

Thanks for the explanation. I still have a couple of doubts, could you please answer them

1. How does it matter if I include tag lib on every page vs in a common jspf vs in web.xml - does it help to improve speed or just manage large projects & change?


2. What are standards practices to include tag lib and common code like headers & footers other than using sitemap or any such plugin?
 
Bear Bibeault
Sheriff
Posts: 67261
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I would venture to say that any performance difference are irrelevant and that you should do whatever provides the most clarity in the context of your project.

2) I know of no "standard practices". There are many layout libraries to choose from. (Some even do everything on the client side).
 
He's my best friend. Not yours. Mine. You can have this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!