ubuntujspjstltomcat8custom-tag

I'm unable to create a custom tag in tomcat8 in ubuntu OS without unsing any IDE


I have to create custom tags to complete my project without using any IDE on ubuntu(Linux) but I'm repeteadly getting an error message.

To create custom tag I've made two files tagfileone.tag and tagfileonetest.jsp and their locations are as: for tagfileonetest.jsp: /var/lib/tomcat8/webapps/ROOT/Trying_Tag for tagfileone.tag: /var/lib/tomcat8/webapps/ROOT/Trying_Tag/WEB-INF/tag

here Trying_Tag is the name of directory where my web application is.

But I repeteadly get an error on browser while running which says:

Trying_Tag/tagfileonetest.jsp (line: 13, column: 28) No tag "tagfileone" defined in tag library imported with prefix "tf"

I'm adding snapshots for more clearance. If someone can help I'll be really grateful.......

Path to JSP File

Path to Tag file

code1

code2

Error


Solution

  • Under the default Ubuntu configuration Tomcat automatically deploys all directories in /var/lib/tomcat8/webapps. You didn't deploy an application Trying_Tag, but only an application ROOT with a folder Trying_Tag. Therefore your JSP is looking in the folder /var/lib/tomcat8/webapps/ROOT/WEB-INF/tags for the tag files and does not find any.

    Move the Trying_Tag folder to /var/lib/tomcat8/webapps and everything should work fine.

    Remark: the URLs will remain the same, because a web application called ROOT has an empty context path, so ROOT/foo/bar.jsp will be accessible with an empty context path and /foo/bar.jsp as path info (the concatenation is /foo/bar.jsp), while foo/bar.jsp will have a context path of /foo and a path info /bar.jsp, which results in the same URL.