This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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: 61314
    
  66

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: 61314
    
  66



Welcome to the Ranch!
 
GeeCON Prague 2014
 
subject: Including a JSP Fragment with JSTL code in it