File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I include jsp file which contains jsp and jstl tags in the custom tag?

 
Alex Indus
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to include .jsp file which contains jstl tags in the custom tag class which extends TagSupport(using tag files isn't an option in my particular case)? I need to create a custom tag to draw a table with the content of page scope variable. Table rows will change according to the attributes of the tag. I have created jsp file with the table but I have no idea how to include it in my tag. Calling pageContext.include() just put the code from jsp into html without any compilation=(
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you name the include file? An include should process the included JSP.
 
Alex Indus
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
table.jspf

custom tag this tag just prints all code from table.jsp to the html page without any transformation(
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A .jspf file is not a JSP. It's a JSP fragment and is only suitable for use with the include directive.

Rename the file with the .jsp file type.
 
Alex Indus
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! I just renamed table.jspf in .jsp, and imported jstl =) I have one more question - can this table get access to the page scope variables of the page where my custom tag is used&
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Place scoped variables that need to be shared in request scope.

By the way, is there a reason that all of this isn't a good use case for a tag file?
 
Alex Indus
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a task to do this using tag class which extends TagSupport. Do you think using tag files make the code simpler?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic