Programming Jakarta Struts, 2nd Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Programming Jakarta Struts, 2nd Edition [Electronic resources] - نسخه متنی

Chuck Cavaness

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








8.2 Tag Libraries Included with Struts


The Struts framework provides a fairly
rich set of framework components. It also includes a set of tag
libraries that are designed to interact intimately with the rest of
the framework. The custom tags provided by the Struts framework are
grouped into four distinct libraries:

  • HTML

  • Bean

  • Logic

  • Tiles


There also is a fifth library, called the Nested tag library, that
we'll talk about separately later in this chapter.


Earlier versions of the Struts framework contained a tag library
called Form. It was replaced with the HTML tag library several
versions ago, but form tags still sometimes show up in the
documentation or example applications.

The tags within a particular library perform similar or related
functions. For example, the tags within the HTML tag library are used
to render HTML presentation components inside HTML forms.
There's a tag to generate a checkbox, another for a
button, and yet another to generate a hyperlink.


8.2.1 Using Tag Libraries with Struts Applications


There's nothing special about using the Struts
tagsthey are like any other JSP custom tags. You must include
the TLD declarations for each tag library you use in every page in
which you need to use them. If you need to use the HTML and Logic tag
libraries in a JSP page, for example, insert the following two lines
at the top of the JSP page:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

Once these lines are included and your web application deployment
descriptor contains the necessary taglib elements, you can use the
HTML and Logic tags within your JSP page. Continuing with the
previous example, you need to add the following lines to your
web.xml file:

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

Based on the snippets above, you would also need to make sure that
the TLD files that are included with Struts are placed in the
WEB-INF directory. This is not the only location
that they can reside, but is the most common.

For more information on configuring the deployment descriptor for the
web application, see "Configuring the web.xml File
for Struts" in Chapter 4.


    / 181