标签库的目的?

发布于 2024-07-14 17:42:56 字数 155 浏览 7 评论 0原文

建立标签库的目的是什么? 虽然我们有可用的基本标签,这使得我们的工作非常简单,但是为什么要有 struts-html.tld。 虽然我们可以通过 usebean、setProperty 和 getProperty 标签轻松调用和使用 bean,但为什么我们有 struts-bean.tld。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

咆哮 2024-07-21 17:42:56

如果您使用普通的旧式 HTML 标记,则必须借助 scriptlet 将值从表单 bean 中取出并放入 html 字段中。 html 标签与 Struts 框架一起工作,自动从表单 bean 字段填充 html 字段,这会导致 JSP 更干净、更易于维护。

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.

野侃 2024-07-21 17:42:56

虽然您可以执行一些基本操作,例如访问 bean 属性并使用它来构建 HTML,但通常您需要在 HTML 页面中执行更多操作。 Struts 提供了许多定义良好的标签,您可以直接使用它们来构造 HTML 元素,例如输入字段或表格等。这意味着,您将不会处理 HTML 元素,而是处理 Struts 标签。 除了提供基本的 HTML 元素外,还有标签库可以帮助您创建更复杂的 HTML 页面。 例如,使用特定的标签库,您只需提供迭代器和映射列标题即可构建整洁的分页表。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文