user67722
user67722

Reputation: 3287

Purpose of 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.

Upvotes: 1

Views: 280

Answers (2)

Jay
Jay

Reputation: 479

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.

Upvotes: 0

harshit
harshit

Reputation: 7951

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.

Upvotes: 2

Related Questions