Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Tag Library  RSS feed

 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a custom tag that display an image which is coming from database.
Tag has getter /setter method in its implementation .. setVisible,getVisible...I want to call getVisible() method on the JSP Page.
something like this <my isplayTag getVisible()/> ...How to achieve this thing???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes no sense. Custom tags are not beans that have properies you can access in that fashion.

What you can do is to have the tag emit scoped variables with "results" that you can utilize in EL references later on the page.
[ July 29, 2005: Message edited by: Bear Bibeault ]
 
Derek Clarkson
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds to me like you are confusing beans with tags. A bean is an object with a specific state. Therefore throughout your html you can get/set it's properties. Tags on the other hand are about processing data and are often used to produce beans which you can then access. Depending on what you are trying to access you might approach things in a number of ways. For example, you might get your tag to create a bean in page scope which <c:if> tags can then interrogate to decide if things should be visible. Or you might construct a tag which optionally includes it's body if the visible flag is set.

There are lots of subtle variations on the above and also ways of mixing tags and beans more closely, but you need to have a clear pciture of what you are trying to achieve first.

ciao
Derek
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!