aspose file tools*
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
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: 61653
    
  67

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: 61653
    
  67



Welcome to the Ranch!
 
Don't get me started about those stupid light bulbs.
 
subject: Including a JSP Fragment with JSTL code in it