• 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

Extending Struts tags

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

I have to extend the Struts Html Tags to implement additional features. I dont know where to start. Can you please provide me with an example to do this would help me lot.

For Eg. I have a text box it should be displayed as Read Only for certain users, Editable for certain users and label for some users. So i am planning to pass role as input parameter, which will decide to dispaly the field accordingly.

Thanks in Advance.

Regards,
Arul.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use you own custom tags to extend struts functionality. I dont have a sample code, but i can tell you how to approach this:-

1. Pass role as a parameter to your custom tag ( I assume you will have this in your JSP page)
2. in the doStartTag of your custom tag class, read this attribute and decide whether to show the text box or not
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd start out by downloading the source code to see how the tag libraries are coded. The class you will want to extend is org.apache.struts.taglib.html.TextTag.
 
Arulanand Dayalan
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot. I would try it out.

Regards,
Arul.
 
reply
    Bookmark Topic Watch Topic
  • New Topic