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

Including JSP Fragments

Reema Patel
Ranch Hand

Joined: Jan 26, 2006
Posts: 169
Hello All,
What I have understood by reading online is that JSP fragments are incomplete JSP pages saved with .jspf extn.

I tried to include one just .jspf file using:
<jsp:include page="/jspf/header.jspf" />
and, inside this JSP fragment I'm trying to read from the implicit request attr.

<html><head><title>Thanks for visiting <%= request.getParameter("fName") %> <%= request.getParameter("lName") %> </title></head><body>

But, this doesn't work, however if I change the extension from.jspf to .jsp it works...pls help...
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

The jspf files will not compile when they have the .jspf extension. If you are using tomcat add this so that tomcat's jsp "servlet" is invoked when the .jspf extension is used.



[EDIT]

By the way... if you want scriplets to be evaluated use the include directive instead. But that means that you cant pass params to the included file like before. Either name your file .jsp to compile it, or associate the jspf extension in web.xml so that they are treated like JSPs, or use the include directive to compile scriplets et all.

Arrrghhhh so many choices !
[ September 30, 2006: Message edited by: John Meyers ]

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Reema Patel
Ranch Hand

Joined: Jan 26, 2006
Posts: 169
Thanks John!
It's working fine now.

 
 
subject: Including JSP Fragments