wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ example page 408 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 "HFSJ example page 408" Watch "HFSJ example page 408" New topic
Author

HFSJ example page 408

Catherine van Borselaer
Greenhorn

Joined: Jun 07, 2005
Posts: 6
Hi,

I'm trying the build the code on HFSJ page 408. This is about including a page with the <jsp:include> tag that has a body. The page i'm trying to include has the same name as in the book, "Header.jspf". In this "Header.jspf" file I try to read out this param from the body of the JSP that does this include, with EL. But it is only printing the EL statement as plain text.

When I change the file "Header.jspf" into "Header.jsp" it is working. What does make sense because it is not a .jsp file. But what about this .jspf, what is this "jsp fragment"? Is this an error in the book? I just looked in the errata page of HFSJ but there is nothing about this.

Thanks!
Catherine van Borselaer
Greenhorn

Joined: Jun 07, 2005
Posts: 6
Ok, I see, maybe it's time to rest for me. I didn't put the extra mapping in my web.xml.

<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jspf</url-pattern>
</servlet-mapping>

Thanks.
Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
Hello Catherine,
Can you please explain your answer.You have given the url pattern
can u post <servlet> tag too in web.xml


SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
Jamed
Ranch Hand

Joined: Apr 17, 2005
Posts: 35
Can you paste your whole web.xml file
Catherine van Borselaer
Greenhorn

Joined: Jun 07, 2005
Posts: 6
Hi,

The problem was that with Tomcat .jspf files are not supported default. So to let these .jspf files work you must put this code in your web.xml. See the errate page of HFSJ.

My web.xml looks like this:
Jamed
Ranch Hand

Joined: Apr 17, 2005
Posts: 35
I only need to have jsp's and web.xml for this example.

I don't need a servlet do I ?

thanks
Catherine van Borselaer
Greenhorn

Joined: Jun 07, 2005
Posts: 6
That is true.
I put my whole web.xml in the reply, but then, I'm lazy...

Here's the source I used.
The includeindex.jsp



And the including page (include.jspf):



You can run it with just calling the includeindex.jsp Only make sure that this <servlet-mapping> is in your web.xml and it will work.

Good luck!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFSJ example page 408
 
Similar Threads
To Hans: Classic Tag, Simple Tag and Tag files
Including JSP Fragments
.jspf file not behaving as .jsp file: example in HFSJ
jsp static include - no joy
using jsp:param