| Author |
Custom JSTL Tag (extending BodyTagSupport) to generate javascript array when pass a java list
|
Micale Raj
Ranch Hand
Joined: Jul 01, 2009
Posts: 30
|
|
Dear Friends,
I want to create a custom JSTL tag ( extending BodyTagSupport ) to generate javascript array when pass a java list. I'm new to JSTL and don't know how to start this. I want this new javascript variable to accessed by java script functions.
I think this is possible. How to do this ?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
Micale Raj wrote:I want to create a custom JSTL tag
There's no such thing as a "custom JSTL tag". The JSTL is a predefined tag library. I assume you mean a "custom tag"?
You don't want to use BodyTagSupport -- that's JSP 1. You want to use JSP 2's SimpleTagSupport.
I'm new to JSTL and don't know how to start this.
That doesn't matter because this has nothing to do with the JSTL.
I want this new javascript variable to accessed by java script functions. I think this is possible. How to do this ?
You can emit any output you want, including JavaScript markup.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Micale Raj
Ranch Hand
Joined: Jul 01, 2009
Posts: 30
|
|
Thanks for the reply. It should be custom tag. I can't use SimpleTagSupport since my project using JSP 1 . I'm trying to do this as following. But I'm getting error : No property editor found for the bean "java.util.List"
The taglib.tld
in Jsp Page,
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
|
JSP 1? That's over 10 years old. There is no excuse for using something so old. What is the reason for this?
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1008
|
|
Extend your tld file to define the attribute of type list
That should look something like:
Looking at your usage in the JSP page. How do you expect "a,b,c" to become a List?
That looks like a comma separated string to me...
# <custom:listToJavaScriptArray list="a,b,c"/>
|
 |
Micale Raj
Ranch Hand
Joined: Jul 01, 2009
Posts: 30
|
|
Stefan Evans wrote:Extend your tld file to define the attribute of type list
That should look something like:
Looking at your usage in the JSP page. How do you expect "a,b,c" to become a List?
That looks like a comma separated string to me...
# <custom:listToJavaScriptArray list="a,b,c"/>
Thanks for the help.
I tried it and it worked. :)
You are right about jsp part. It's a comma separated string. I used a java.util.List from request build the array. Now it's working. Thank you very much ! :)
|
 |
 |
|
|
subject: Custom JSTL Tag (extending BodyTagSupport) to generate javascript array when pass a java list
|
|
|