views:

119

answers:

2
+1  Q: 

Tag library?

What is the purpose of having tag library? Though we have the basic tags available which makes our work very simple, what is the reason to have a struts-html.tld. Though we can call and use the bean easily through usebean, setProperty and getProperty tags why we have struts-bean.tld. I am a newbie, so kindly clarify my doubts..

Thanks in advance

+2  A: 

If you use plain old HTML tags, you'll have to resort to scriptlets to get the values out of the form bean and into the html fields. The html tags work with the Struts framework to automagically populate html fields from your form bean fields and this results in JSPs that are cleaner and easier to maintain.

harshit
A: 

While you can do basic things like accessing bean property and using it to construct your HTML, often you require to do much more in your HTML pages. Struts provide a lot of well defined tags that you can use directly to construct your HTML elements, such as your inputs fields or tables etc. And this means, you won't be dealing with HTML elements but struts tags. Apart from providing basic HTML elements, there are tag library that help you create more complex HTML pages. For an e.g, with a particular tag library, you can construct neat paginated table just by providing an iterator and mapping column headers.

Jay