• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

HFSJ example page 408

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Catherine,
Can you please explain your answer.You have given the url pattern
can u post <servlet> tag too in web.xml
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you paste your whole web.xml file
 
Catherine van Borselaer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic