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

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
JSP foreach tag for two variables

Categories

HOME
testing
urbancode
push-notification
dot
wamp
mouse
awesome-wm
communication
here-api
etl
moonmail
highlight.js
propel
contextmenu
reverse-proxy
ml
jasonette
chromium-embedded
microsoft-sync-framework
tdd
intel-pin
libssl
procdump
unboundid
exuberant-ctags
titanium-mobile
catch-all
form-data
swift3.0.2
streamsets
webdriver-manager
awt
sfdc
ncalc
janrain
keydown
outlook-api
modelmapper
dotcover
forever
directory-structure
mako
zendesk-app
titanium-android
pintos
abcpdf9
google-feed-api
spring-android
passport-google-oauth
mongocsharpdriver
qpid
react-native-listview
pagedlist
xna-4.0
eclipse-clp
myo
generic-programming
nsight
mmc
e10s
jsapi
javax.mail
website-monitoring
tt-news
wordpress-theme-customize
html-helper
code-access-security
zend-route
funcunit
ember-charts
gnu-smalltalk
mysqltuner
cos
padarn
automount
osql
netbeans-6.9
vdsp
recent-documents
castle-monorail
webkit.net
uimenucontroller
eqatec
phonon
putchar
msdev
ajax-forms

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