• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

custom tag attribute validation

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am writing a custom tag and one of the attributes is a string. For this attribute I want the user the user to enter one of 5 possible values.

I wanted to know the best way of validating this attribute to make sure the user has added on of the possible 5 values.

What is the best way of doing this?

Thank you

David
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If user means end user and attribute value will be dynamic, you must validate it for yourself.
If user means developer who will use this tag, you can use special api.
search google for TLV (tag library validation)
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are writing a tag used by other developers and you want to validate the value of the attribute, then you may consider using TagExtraInfo (tei) classes. You could override the isValid() method to return true/false. A TagData object is passed to this method which contains the attribute values. This works at translation time and hence if your attribute supports runtime translation (rtexpr value = true), this will not work.

Here are links to some resources
1. http://today.java.net/pub/a/today/2004/02/04/validation.html
2. http://www.onjava.com/pub/a/onjava/2001/01/18/jsptags.html?page=last

ram.
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic