wood burning stoves 2.0*
The moose likes JSP and the fly likes Including a JSP Fragment with JSTL code in it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Including a JSP Fragment with JSTL code in it" Watch "Including a JSP Fragment with JSTL code in it" New topic
Author

Including a JSP Fragment with JSTL code in it

Peter Velosy
Greenhorn

Joined: Nov 29, 2012
Posts: 2
Dear Forum members,

I've run into the following problem, and although I have tried googling and searching through the forums, I didn't find an appropriate answer.

My problem is as simple as this:

I would like to include the following segment in many JSP pages, which displays a login link if the user is not logged in, and a logout link with the username if he is already logged in.



I've put the @taglib directive here too for safety reasons, but it's also there in the page where I'm trying to include this segment with:



However, the main JSP page just reads my JSPF line by line instead of parsing the JSTL code included in it. How can I change the code, so that the JSTL Choose actually gets parsed?

Many thanks,
Peter
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Rename the file to .jsp. The .jspf file type should only be used with the include directive, not the include action.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Peter Velosy
Greenhorn

Joined: Nov 29, 2012
Posts: 2
Thank you very much, it works! I didn't know about this difference.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65



Welcome to the Ranch!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Including a JSP Fragment with JSTL code in it
 
Similar Threads
jsp: include not working...
Problem with HttpSession in Struts2
Do we have to configure web.xml for using jstl tags
Best way to find out of user is logged in
Final Mock Test Question 26 Head First and Servlets