File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 60041
    
  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: 60041
    
  65



Welcome to the Ranch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Including a JSP Fragment with JSTL code in it
 
Similar Threads
jsp: include not working...
Final Mock Test Question 26 Head First and Servlets
Best way to find out of user is logged in
Do we have to configure web.xml for using jstl tags
Problem with HttpSession in Struts2