jsp-tags


Invalid tagdir attribute while web-fragment is used


I am using web-fragment feature to maintain my JSPs and tags in a jar, and using this approach, my JSP pages are unable to find the tagdir, and cause "The value of the tagdir attribute for this tag library is invalid."
Here is the structure in my jar.
META-INF
-- resources
-- WEB-INF
-- tags
-- mytag.tag
-- mypage.jsp
-- web-fragment.xml
In mypage.jsp, I specify the taglib as following:
And I got these errors:
mypage.jsp:7:4: The taglib directive must specify either the "uri" or "tagdir" attribute.
mypage.jsp:7:33: The value of the tagdir attribute for this tag library is invalid.
It seems like under this approach, it cannot find the tagdir. I tried the same structure in my war with web.xml, and it was able to find the tags. So I wonder if there is any way I can use the similar solution with web-fragment approach.
You don't need WEB-INF in the web-fragment project. Use this structure instead:
web-fragment project:
META-INF/
-- resources/
-- tags/
-- mytag.tag
-- mypage.jsp
-- web-fragment.xml
Everything inside the resources directory will now be available to referencing projects as if they were deployed inside WEB-INF.
web project:
WEB-INF/
-- tags/
-- othertag.tag
-- (mytag.tag)
-- otherpage.jsp
-- (mypage.jsp)
So to reference mytag.tag from the web project:
<%# taglib prefix="my" tagdir="/WEB-INF/tags" %>
...
<my:mytag ... />
As for the errors you are seeing, I don't know what you tried, but here's how you'd do it:
for a .tag you must specify tagdir and set it to the tag's folder:
<%# taglib prefix="my" tagdir="/WEB-INF/tags" %>
for a .tld you must specify uri and set it to the tld's URI:
<%# taglib prefix="mytld" uri="http://example.com/tld/my" %>

Related Links

restrict image file size in alloy UI
The function getContextPath must be used with a prefix when a default namespace is not specified
how can i retrive parameters from EncodeURL using jsp?
onclick tag giving error in h:commandLink
Displaytag - How to pass hidden value in url?
Embedding Tag Files in a JAR
Errors when the compiler is trying to build a custom JSP tag based on an Java Bean
Creating nested custom tag using jsp2 tag files
Unable to access session on JSP
Dealing with <html:options>
No tag “tableFacade” defined in tag library imported with prefix “jmesa”
how to refer values of one jsp file to other jsp
incorrect username and passwords
creating the welcome page
How to use list object in <c:forEach tag?
How to call a Servlet when I click on a Hyperlink

Categories

HOME
java
wso2-am
variables
iot
electron
relay
spagobi
q
programming-languages
analysis
yum
opengl-es-2.0
android-youtube-api
add
facebook-messenger-bot
dacpac
metatrader4
ibm-odm
clojurescript
libtiff
cx-freeze
sylius
mustache.php
tibco-mdm
autosys
firebase-crash-reporting
kannel
google-qpx-express-api
kendo-ui-grid
usbserial
nssegmentedcontrol
swisscomdev
dynamics-crm-2013
streamsets
lumberjack
gpx
sencha-touch-2.3
thin
chain-builder
strptime
statsd
mako
gnome-shell-extensions
background-service
static-ip-address
deadbolt-2
phishing
paypal-express
clang-static-analyzer
pagedlist
ubuntu-10.04
python-stackless
rhino-servicebus
iad
pervasive-sql
qtableview
jms2
ruby-2.2
emailrelay
responsive-images
mono-embedding
nsmutabledictionary
xc16
phalanger
rdtsc
rdl
doskey
hippomocks
undefined-reference
uv-mapping
page-layout
c18
quantlib-swig
tidy
padarn
django-nonrel
android-hardware
trusted
mt
reddot
assembly-loading
eclipse-templates
cinema-4d
pyinotify
gdlib
yslow
modelstate
bespin
firefox-5
zend-tool
memory-size
libs
avatar
premature-optimization
geneva-server

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App