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

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
Invalid tagdir attribute while web-fragment is used

Categories

HOME
cloud
c#-4.0
azure-data-factory
platform-builder
react-router
google-project-tango
installshield
opengl-es-2.0
indesign
qore
append
session-variables
gz
visual-studio-cordova
ups
facebook-page
code-review
visjs
tapestry
kvc
pass-by-reference
tibco-mdm
microsoft-r
internet-explorer-9
traffic
applozic
wtx
javascriptcore
oracle-fusion-middleware
gtrendsr
http-get
usbserial
http-referer
y86
environment-modules
main
starteam
webdriver-manager
graphenedb
texmaker
sencha-touch-2.3
wptoolkit
appcompat
filepicker
react-scripts
promela
hendrix
boost-multi-index
dotnetzip
directory-structure
redundancy
medium.com
wdf
elements
login-control
ctest
impresspages
javax.sound.midi
atk4
computer-algebra-systems
drawbitmap
0xdbe
sankey-diagram
skos
network-interface
relocation
dml
message-driven-bean
c18
sitemesh
excel-2003
qt-faststart
sqlperformance
interface-orientation
ocunit
android-hardware
propertyeditor
ocx
bigcouch
adk
php-parser
mongomapper
dmx512
suppress
web-architecture
javap
anti-piracy
noscript
pascal-fc

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