jsp-tags


JSP Custom Tag File and Dynamic attributes


I have a custom JSP tag tag file, which is a wrapper around HTML input controls - dropdown etc, like so -
<mytag:dropdown table="customer_master" style="display:block;" class="dblist"/>
Here "table" is a declared attribute of the tag where as style, class are dynamic-attributes.
Now I would like to wrap this is in another tag like so -
<mytag:search-filter type="dropdown" validate="true" table="mytable" style="display:block;" class="dblist">
I am trying to implement mytag:search-filter as follows -
<#tag .... dynamic-attributes="dynattrs">
<#attribute name="type" required="true">
<c:if test="${type == 'dropdown'}">
<mytag:dropdown table="$dynattrs['table']">
</c:if>
The outer tag has its own set of declared attributes and I want the inner tag's attributes to be passed in as dynamic attributes to the outer tag.
The outer tag will then pass its dynamic attributes to the inner tag
I have tried the following and none of them seem to work -
<c:set var="attrs">
<c:forEach items="${dynattrs}" var="a">
${a.key}="${a.value}"
</c:forEach>
</c:set>
<mytag:dropdown table="$dynattrs['table']" ${attrs}/>
The above gives a "Unterminated Tag %lt;mytag:dropdown" Error
<mytag:dropdown table="$dynattrs['table']">
<c:forEach items="${dynattrs}" var="a">
<jsp:attribute name="${a.key}" trim="true">${a.value}</jsp:attribute>
</c:forEach>
</mytag:dropdown>
** The above does not throw any error, but the attribute value inside the inner tag is always empty.
Constraints I have :
a) I want to stick to tag files and do not want to use Java class implementation of TagSupport.
b) As far as possible, do not want to change the inner tag implementation because it is widely used in its current form and any change to it means a huge effort on rework.
Is it possible to achieve what I am trying to do ?
Why do the above not work (especially the second one) ?

Related Links

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
EL Messages on JSP page
showmodaldialog function in ie8
displaytag export options banner - place at top of table
JSP custom tag library (Unable to find setter method for the attribute)
JSP custom tag library (Passing Attributes)
creating a custom JSP tag

Categories

HOME
pdf
openlayers
asp.net-core
tizen
ngrx
iterator
relay
sd-card
octobercms
mean-stack
android-4.4-kitkat
directx
add
slick-slider
gnupg
tomcat6
rascal
export-to-csv
google-cloud-spanner
task
pc
karma-jasmine
google-pagespeed
lldb
jtextfield
amazonsellercentral
kryo
cx-freeze
cloudhub
wkwebview
kvc
django-storage
dynamic-featured-image
fluentvalidation
minitab
ping
compatibility
libuv
junit5
yadcf
uiswipegesturerecognizer
force-layout
wpf-controls
mixture-model
code-search-engine
sqlite2
fedex
gulp-sourcemaps
nomethoderror
midl
eclipse-gef
apple-news
revapi
atomicity
veracode
elgg
nativeapplication
lift-json
capacity
migradoc
yt-project
sts-springsourcetoolsuite
google-web-starter-kit
rvest
intel-fortran
kcachegrind
microbenchmark
operation
streambase
bridge.net
python-green
ng-animate
tablelayout
knuth
xojo
google-reader
plasma
comaddin
browser-detection
nsnetservice
frameset
labwindows
ticoredatasync
dotnethighcharts
jquery-ui-layout
adk
heartbeat
horizontal-accordion
lpeg
.nettiers
dentrix
nsviewanimation
privilege
grid-system

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