| Author |
JSTL + custom tags
|
Jorge Blaz
Ranch Hand
Joined: Jan 31, 2004
Posts: 53
|
|
Hello, I want to pass a dynamic property to a custom tag. I'm using JSTL 1.0 + Jsp 1.2 I've tried this, but none of the above seem to work: <mytag:city postalCode="<c ut value='${myCode}' />" /> <mytag:city postalCode="${myCode}" /> Any ideas of how to do this?. (the "myCode" variable is stored in page context) Thanks in advance. Jorge
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56199
|
|
In JSP 2.0 your second example will work just fine since the EL is evaluated by the JSP container. Under JSP 1.2 you're kinda stuck because the EL is only interpreted by the JSTL tags. Here are some options: 1) Evaluate the EL expression within your tag using the JSTL API. I've not done this (since I use JSP 2.0) so I don't know how hairy it is. 2) Do something like: where you tell the tag how to look up the value in the scoped variables. 3) Punt back to scriptlet expressions: 4) Upgrade to Tomcat 5 and JSP 2.0/JSTL 1.1.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56199
|
|
|
Btw, your topic title would better have been "EL and custom tags".
|
 |
Jorge Blaz
Ranch Hand
Joined: Jan 31, 2004
Posts: 53
|
|
The best option would be number 1, but it will be hard to find examples of how to do this. Options 3 and 4 are good but I must use JSP 1.2 and I try to avoid scriptlets by using JSTL and custom tags. So, i will try to do it with option 2. Thanks for the help Bear, and you're right, the title should have been better EL and custom tags.
|
 |
 |
|
|
subject: JSTL + custom tags
|
|
|