aspose file tools
The moose likes JSP and the fly likes tag file parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "tag file parameters" Watch "tag file parameters" New topic
Author

tag file parameters

Jim Largent
Greenhorn

Joined: Feb 17, 2010
Posts: 6
I created a tagfile and I want to have an either/or required parameter. In other words, you must specific 1 of 2 parameters. Any suggestions on how best to approach this? Right now I've just made them all optional and rely on myself to know that I need to specify one or the other.
Thanks
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48842

Tag files are great and I use them a lot, but they don't give you a lot of computational capabilities. If possible, I'd rejigger things such that there is one required parameter.

If that's not possible you could consider one of:
  • Make them both required, but allow one to be empty. [Yuck]
  • Leave them optional, and provide a reasonable default for when neither is specified.
  • Use a helper bean within the tag to do some validation (what I fancifully call a "Valet").
  • Revert to using a SimpleTag implementation instead of a tag file.

  • This message was edited 2 times. Last update was at by Bear Bibeault


    [Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
     
     
    subject: tag file parameters
     
    MyEclipse, The Clear Choice