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

Build URL to query JSP
how can we display value in java server page set in dto
Difference between jsp include action tag and jsp include directive
How to iterate through a list of list in jsp
JSP Custom Tag File and Dynamic attributes
Fetch drop down box multi selector
jsp code to upload jgp files and save in mysql db
when I run my jsp pgogram I got this exception error type Exception report
jstl formatNumber in input leads to NumberFormatException
Youtube onYouTubePlayerReady() function not firing
username and password cannot be resolved or is not a field
How page directive “extend” in jsp works?
Simple property not found?
Reusing JSP custom tags inside html
JSP Quiz process is not giving me the correct percentage scored
Refer the id variable of logic - iterate using jstl-el

Categories

HOME
ibm-bluemix
yii2
testng
vbscript
fluentd
nullpointerexception
vmware
tesseract
getelementsbytagname
leon
infragistics
cakephp-2.5
upload
slick-slider
hex-editors
workload-scheduler
finite-automata
normalizr
excel-vba-mac
contextmenu
visjs
ml
mustache.php
bootstrap-tour
pepper
django-storage
internet-explorer-9
linkerd
social-media
minitab
maquette
ping
microsoft-chart-controls
bluestacks
react-chartjs
uisplitview
create-table
pdb
copying
azure-sql-database
wallpaper
amazon-kinesis-kpl
sequential
simplexml
retina-display
service-discovery
webix-treetable
document.write
greenrobot-eventbus
hp-ux
nomethoderror
android-mediaprojection
thin
long-polling
flickr-api
outlook-2013
chain-builder
worksheet
slickedit
tactic
gcsfuse
mcafee
spring-cache
watchconnectivity
cubes
storekit
superstack
python-stackless
ios4
two-factor-authentication
wso2cloud
php-ci
ios9.1
mono-embedding
angular-local-storage
kineticjs
google-reader
mesa
web2py-modules
listings
http-unit
specification-pattern
bluepill
first-responder
twrequest
enter
nsmanagedobject
gwt-ext
inotifycollectionchanged
celltable
floating
paster
gallio
icanhaz.js
modelstate
routedevent
meego
audio-capture
backcolor
eqatec
simpletest
premature-optimization
nerddinner
msdev
signal-handling

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