wood burning stoves 2.0*
The moose likes JSP and the fly likes Calling Custom tag Dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Calling Custom tag Dynamically" Watch "Calling Custom tag Dynamically" New topic
Author

Calling Custom tag Dynamically

Shashi Prakash
Ranch Hand

Joined: Mar 28, 2007
Posts: 40
Hi,
I have many Custom tags in my application.. I wanted to use diffent tags based on some condition..

e.g..
Suppose I have myRadio and mySelect custom tag.. and I want to call these based on some condition..

<myTagsome variable) />

Here (Some variable) should be replaced by myRadio or mySelect based on given condition..

How can I implement this..

Please help me with this..


Thanks,<br />Target Scwcd<br />SCJP 1.4
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
you cannot do it the way you ask, but you can surround your tag with a <c:if> tag from JSTL
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Or define the tags in the first place to be able to detect when they should manifest themselves in different ways.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shashi Prakash
Ranch Hand

Joined: Mar 28, 2007
Posts: 40
you cannot do it the way you ask, but you can surround your tag with a <c:if> tag from JSTL
----------------------------

Yes I can do this but the problem is that I have so many dynamic attributes .. and I don't want to have repetitive code ...
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
then Bear has the workable solution
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Calling Custom tag Dynamically
 
Similar Threads
Include code in JSP
Display tags and Jsp Scriptlet
JSP 2.0 Custom Tags and Database
JSP Custom Tags
Too many drop down lists in my page