Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
YuYu LiLi
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!