0

I'm creating a custom JSP tag to generate tables from a data object. To make the code cleaner I wanted a separate tag file for the rows but I can't seem to be able to include a custom tag in my main custom tag (sorry I know it's confusing).

For example I have:

Table.tag:

<%@taglib prefix="tags" uri="urn:jsptagdir:/WEB-INF/tags" %>
<%tag description="My Table">
<table>
...
  <tags:row data="${dataRow}"/>
</table>

Row.tag

<%tag description="My Row">
<tr>
  <td>...</td>
  <td>...</td>
  ...
</tr>

Note the import in the first file (<%@taglib prefix="tags" uri="urn:jsptagdir:/WEB-INF/tags" %>). That is generated by the editor when I try to use the row tag but it doesn't work. In the final page I see <tags:row data="${dataRow}"/> instead of the expected result.

I tried to change the import to <%@taglib prefix="tags" tagDir="/WEB-INF/tags" %> - which is how I use the table tag - but the result is the same.

What am I doing wrong?

algiogia
  • 936
  • 2
  • 14
  • 40

1 Answers1

0

I have resolved the issue following the instructions in this answer: JSP Tag Files in subdirectories, using a single taglib prefix. Is that possible?

I have created a .tld file describing my custom library and then imported it in the main tag.

algiogia
  • 936
  • 2
  • 14
  • 40