• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

is EL can be used in an included header jsp file?  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, everybody!

I have something I don't understand. Please help me. Thanks a lot.

The scenario is:

"Head.jspf" is included in "Contact.jsp"
<img src="images/Web-Services.jpg"><br>
<em><strong>${paramValues.subTitle}</strong></em><br>

"Footer.jspf" is included in "Contact.jsp"
<a href="index.html">home page</a><br>
${param.email}

"Contact.jsp" includes "Head.jspf" and "Footer.jspf"
<html><body>
<jsp:include page="Header.jspf">
<jsp : param name="subTitle" value="We take the sting out of SOAP." />
</jsp:include>
<hr><br>
<em>We can help.</em><br><br>
<br><hr>
<jsp:include page="Footer.jspf">
<jsp: param name="email" value="likexuan1996@yahoo.com" />
</jsp:include>
</body></html>

load "Contact.jsp" on my tomcat5, I just got:
${paramValues.subTitle}
We can help.
home page
${param.email}

The problem is those ELs in my Header.jspf and Footer.jspf don't work.

Anybody can help me? Thank you very very much!

[ December 17, 2005: Message edited by: YuYu LiLi ]

[ December 17, 2005: Message edited by: YuYu LiLi ]
[ December 17, 2005: Message edited by: YuYu LiLi ]
 
YuYu LiLi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I just got it.
If you want to use EL in a jsp page which is going to be included in other jsp pages, you must not name it like *.jspf. you should name it like this way: *.jsp. That's it.
 
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The .jspf file type should only be used for files included with the include directive, not files included with the include action.

In the former case, the file becomes part of the original jsp and is processed with the parent. In the latter case, it is processed separately, and so changing the file type to something other than .jsp will prevent the file from being processed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!