This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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.
 
Marshal
Posts: 67163
169
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!