JSTL Introduction: that is all (c)

2010-11-10  来源:本站原创  分类:Web  人气:171 

In previous articles of this series, we discussed the JSTL and Expression Language (EL). We also study the core library as defined by the custom tag. Specifically, in the "JSTL Introduction: The expression language" that we provide a simplified language EL, used in JSP applications to access and manipulate data and make the JSTL custom tag data can be used as a dynamic property values. core library contains a number of custom tags, for managing scoped variables, display EL value, content and conditions of realization of iterative content and interact with the URL, which is "JSTL Introduction: To study the core" of the topic.

We then will discuss the JSTL fmt library is a library. fmt custom tag library support through the resource bundle to localize the content of the text, and support for numbers and dates of display and analysis. Using these markers in the java.util and java.text package to achieve the internationalization of Java language API, so if you are already familiar with, such as ResourceBundle, Locale, MessageFormat and DateFormat this class, you will find there are many aspects fmt library commendable. If you are not familiar with these classes, then the fmt tag library packaged with an intuitive approach to the internationalization API, this approach will enable you to easily localize features into JSP applications.

Localization

API in the Java language internationalization, the impact of the data localization means there are two main factors. One is the user's language environment, and the other is the user's time zone. Language environment that a particular region or culture, language and customs, including the date, number and currency amount format. A language environment will always be an associated language, in many cases, this language is shared by more than one language environment of a language dialect. For example, American English, British English, Australian English and Canadian English has a different English language environment, and France, Belgium, Switzerland and Canada were used in the French dialect of the French language has a different environment.

The time zone is localized in the second data elements, it is only because some of the language environment, a wide geographic distribution. When you display information about the intercontinental language environment (such as Australian English) time information for users to customize the time zone data is as important as its formatted correctly.

But this has a problem: how to determine the user's application locale and time zone? In the case of Java application, JVM able to interact with the local operating system to set the default locale and time zone. While this approach for desktop applications, will work, but it is actually not suitable for server-side Java applications, because the requests handled by the application may be away from the application resides place thousands of miles away from the server.

Fortunately, HTTP protocol through the Accept-Language request header to pass localization information from the browser to the server. Many Web browsers allow users to customize their language preferences. Typically, one or more of those who are not the preferred language for the environment provides explicitly set the browser will ask the operating system to determine the Accept-Language header value sent in which (or what value). servlet specification through the javax.servlet.ServletRequest class getLocale () and getLocales () method automatically use the HTTP protocol functions. JSTL fmt library of custom tags will use these methods to automatically determine the user's language environment, and thus adjust their output accordingly.

Unfortunately, there is no user's time zone transfers from the browser to the server's standard HTTP request headers. Thus, those who want their Web applications to be localized on the time data users will need to implement their own mechanism for identifying and tracking user-specific time zone. For example, in Part 2 of this series "JSTL Introduction: To explore the core" described in the Weblog application contains a user's time zone preference stored in the cookie of way.

fmt library

JSTL fmt custom tag library is divided into four groups. The first group allows you to set the localization context in which other tags will operate. In other words, this set of tags allows the page author to explicitly set the data format of other fmt markers will be used when the locale and time zone. Marking the second group and third group were carried out to support the date and number formatting and parsing. The last set of markers focused on text messages to be localized.

Since we already have some basic understanding, let us concentrate on one by one of the four sets of tags, and demonstrate its use.

Localized context tag

As we have discussed that, JSTL tag data in the format used when the language environment is often sent by viewing the user's browser for each HTTP request header contains Accept-Language determined. If no such header, then the JSP JSTL provides a set of configuration variables, you can set these variables to specify the default locale. If you have not set these configuration variables, then use the JVM's default locale, the default language environment is to run from the JSP container to get the operating system.

fmt library provides its own custom tag to cover the process of determining the user locale: <fmt:setLocale>. As shown in the following code fragment, <fmt:setLocale> operation supports three attributes:

<fmt:setLocale value="
        expression"
    scope="
        scope" variant="
        expression"/>

Only one attribute is required: value property. The value of the property should be the name of the language environment is java.util.Locale a string or an instance of the class. Locale name is so organized: lowercase two-letter ISO language code, optionally, can be followed by an underscore or hyphen and uppercase two-letter ISO country code.

For example, en is the English language code, US is a U.S. national or regional code, so en_US (or en-US) will be the American English language environment name. Similar, fr in French language code, CA Canada's country code, so fr_CA (or fr-CA) is a Canadian French language environment name. Of course, the country code is optional, so en and fr itself is a valid locale name for the language does not distinguish between application-specific dialects.

<fmt:setLocale> scope optional attributes to specify the scope of the locale. page scope that this setting only applies to the current page, and request scope to apply it to all requests for JSP pages during the visit. If scope property set session, then the specified locale is used during the user session to access all JSP pages. Value application noted that the language environment for the application of all the Web pages of all requests for JSP and all users of the application of all requests.

variant attribute (also optional) allows you to focus further on a specific Web browser, platform or vendor custom locale. For example, MAC and WIN are Apple Macintosh and Microsoft Windows platforms variant name.

The following code snippet shows how to use <fmt:setLocale> tag to explicitly specify the locale settings the user session:

<fmt:setLocale value="fr_CA" scope="session"/>

JSP container processed in the JSP code, the browser will ignore the user specified in the set language preferences.
<fmt:setTimeZone> as operating like <fmt:setLocale> can be used to set the custom tags used by other fmt the default time zone value. Its syntax is as follows:

<fmt:setTimeZone value="
        expression"
    var="
        name" scope="
        scope"/>

And <fmt:setLocale>, can only value attribute is required, but in this case it should be the time zone name or java.util.TimeZone instance of the class.
Unfortunately, for the time zone name is currently no widely accepted standard. So you can mark the value property for <fmt:setTimezone> time zone name is specific to the Java platform. You can call java.util.TimeZone class getAvailableIDs() static method to retrieve a list of valid time zone names. Examples include US/Eastern, GMT+8 and Pacific/Guam.

And <fmt:setLocale> the case, you can use the optional scope attribute to indicate the scope of the time zone settings. The following code demonstrates the usage of <fmt:setTimeZone>, which is used to specify for a single user session time zone:

<fmt:setTimeZone value="Australia/Brisbane" scope="session"/>

You can also use <fmt:setTimeZone> operation TimeZone instance value is stored in a scoped variable. In this case, you can use var attribute to name a scoped variable, scope attribute to specify the scope of the variable (for example, as the two properties used in the <c:set> and <c:if> operation.) Please note that when you use <fmt:setTimeZone> operate in this manner, it is the only side effect is to set the specified variable. When specifying var property, for what any other time zone to use JSTL tags do not make any changes to the JSP environment.
This group is <fmt:timeZone> operation last tag:

<fmt:timeZone value="
        expression">

        body content
</fmt:timeZone>

And <fmt:setTimeZone>, you can use this tag to specify the JSTL tags used by other time zone. However, <fmt:timeZone> limited to their scope of operation of the body tag content. In <fmt:timeZone> tag body, the tag value attribute specifies the time zone covering the existing JSP environment any other time zone settings.
And <fmt:setTimeZone> the case, <fmt:timeZone> tag value property should be the time zone name or java.util.TimeZone instance. Later provided a list of 1 example of how to use <fmt:timeZone>.

Date Stamp

fmt library contains the date and time to interact with the two markers: <fmt:formatDate> and <fmt:parseDate>. As the name implies, <fmt:formatDate> used to format and display the date and time (data output), and <fmt:parseDate> used to parse the date and time values (data input).

<fmt:formatDate> The syntax is as follows:

<fmt:formatDate value="
        expression"
    timeZone="
        expression"
    type="
        field" dateStyle="
        style"
    timeStyle="
        style"
    pattern="
        expression"
    var="
        name" scope="
        scope"/>

Only value property is required. The value should be java.util.Date instance of the class, specify the format and display the date and / or time data.
Optional timeZone property that will be displayed which time zone the date and / or time. If you do not explicitly specify timeZone property, then use any <fmt:timeZone> tag around the specified time zone. If <fmt:timeZone> tag does not include the main part of <fmt:formatDate> operation, then the operation of any applicable <fmt:setTimeZone> set time zone. If no relevant <fmt:setTimeZone> operation, then use the JVM's default time zone (that is, for the local operating system time zone settings).

type property that you want to display an instance of the specified Date which fields should be time, date or both. The default value of the property is date, so if you did not give type property, then <fmt:formatDate> tag (truly) will only display the date associated with the Date instance of information, this information using the tag value attribute.

dateStyle and timeStyle properties were pointed out how it should be formatted date and time information. Effective style has default, short, medium, long and full. The default value is naturally default, that should use locale-specific style. The semantic value of the other four styles and java.text.DateFormat same class definition.

You can use pattern attribute to specify custom styles without having to rely on the built-in styles. Custom styles are given, the value of the property of the model should be consistent with the pattern agreement java.text.SimpleDateFormat class string. The model is based on the date and time with the corresponding mode field instead of the characters specified. For example, the model that should be displayed MM/dd/yyyy separated by forward slash double-digit month and date values, and four-digit year value.

If you specify var property, it contains the formatted date String the value assigned to the specified variable. Otherwise, <fmt:formatDate> tag will write the formatted results. When specifying the var attribute, scope attribute specifies the scope of the variable generated.

Listing 1 contains two <fmt:formatDate> tag usage. In the first usage, <fmt:formatDate> weblog only the first item to display the creation date portion of timestamp. In addition, a full dateStyle attribute specifies the value, so that all the date fields will be in a locale-specific format to display.

Listing 1. <fmt:formatDate> Tags used to display the date and time values

<table>
<fmt:timeZone value="US/Eastern">
<c:forEach items="${entryList}" var="blogEntry" varStatus="status">
<c:if test="${status.first}">
        <tr><td align="left">
          <fmt:formatDate value=
              "${blogEntry.created}" dateStyle="full"/>
        </td></tr>
      </c:if>
      <tr><td align="left">
        <c:out value="${blogEntry.title}" escapeXml="false"/>
      </td></tr>
    <tr><td align="left">
      <c:out value="${blogEntry.text}" escapeXml="false"/>
      <font>
        [Posted <fmt:formatDate value="${blogEntry.created}"
                                pattern="h:mm a zz"/>]
      </font>
    </td></tr>
  </c:forEach>
  </fmt:timeZone>
</table>

In <c:forEach> loop, the second operation is only used to display <fmt:formatDate> creation date for each item of the time part. In this case, pattern attribute is used to control the time value of the format, and to control the specified number of hours of a show (if possible), 12-hour clock and the output time zone abbreviations. Output shown in Figure 2:

More precisely, the user's browser setting specifies the first option is English, will produce the output shown in Figure 2. However, due to <fmt:formatDate> user locale-sensitive, so change your browser preferences will lead to generate different content. For example, when given the first option is the French-language environment, the results shown in Figure 3:

<fmt:formatDate> instance generated java.util.Date localized string representation, and perform the reverse operation <fmt:parseDate> operation: given a representation date and / or time string, it will generate the Date object. <fmt:parseDate> operating in two formats, as follows:

<fmt:parseDate value="
        expression"
    type="
        field" dateStyle="
        style" timeStyle="
        style"
    pattern="
        expression"
    timeZone="
        expression" parseLocale="
        expression"
    var="
        name" scope="
        scope"/>
<fmt:parseDate
    type="
        field" dateStyle="
        style" timeStyle="
        style"
    pattern="
        expression"
    timeZone="
        expression" parseLocale="
        expression"
    var="
        name" scope="
        scope">

        body content
</fmt:parseDate>

For the first form, only value property is required, its value should be a specified date, time, or the combination of the two strings. For the second form, there is no required attributes, the value of that string to parse is specified as the required tag <fmt:parseDate> tag body content.

type, dateStyle, timeStyle, pattern and timeZone attributes <fmt:parseDate> and <fmt:formatDate> play the same role, the difference only lies in the former, they control the value of the resolution rather than the date shown. parseLocale attribute used to specify a language environment will be based on the language environment in which to resolve the value of the mark, it should be the name of the locale or Locale instance of the class.

var and scope attribute used to specify a scoped variable (as a result of <fmt:parseDate>), will Date object is assigned to the variable. If no var property, use Date class toString() method writes the results to JSP pages. Listing 2 shows an example of <fmt:parseDate> operation:

Listing 2. <fmt:parseDate> Marked with the date and time to resolve

<c:set var="usDateString">4/1/03 7:03 PM</c:set>
<fmt:parseDate value="${usDateString}" parseLocale="en_US"
               type="both" dateStyle="short" timeStyle="short"
               var="usDate"/>
<c:set var="gbDateString">4/1/03 19:03</c:set>
<fmt:parseDate value="${gbDateString}" parseLocale="en_GB"
               type="both" dateStyle="short" timeStyle="short"
               var="gbDate"/>
<ul>
<li> Parsing <c:out value="${usDateString}"/> against the
U.S. English
     locale yields a date of <c:out value="${usDate}"/>.</li>
<li> Parsing <c:out value="${gbDateString}"/> against the
British English
     locale yields a date of <c:out value="${gbDate}"/>.</li>
</ul>

The output of Listing 2 is shown in Figure 4.

<fmt:parseDate> analysis performed by the very strict attention to this very important. As Listing 2 suggests, the value to be parsed must strictly comply with specific (language-specific environment), the style or mode. This is of course more limited. On the other hand, the data analysis is not a very suitable for the task of the presentation layer. For production code, text input validation and conversion are best back-end code (such as servlet) to process, rather than through the JSP custom tags to handle.

Figures marked

As <fmt:formatDate> and <fmt:parseDate> tags for formatting and parsing dates, like, <fmt:formatNumber> and <fmt:parseNumber> markers perform a similar function of digital data.

<fmt:formatNumber> tag is used to locale-specific way to display digital data, including currencies and percentages. <fmt:formatNumber> operating environment identified by language, for example, use a period or comma delimited numbers in the integer and fractional part. Here's the syntax:

<fmt:formatNumber value="
        expression"
    type="
        type" pattern="
        expression"
    currencyCode="
        expression" currencySymbol="
        expression"
    maxIntegerDigits="
        expression" minIntegerDigits="
        expression"
    maxFractionDigits="
        expression" minFractionDigits="
        expression"
    groupingUsed="
        expression"
    var="
        name" scope="
        scope"/>

As in the case as <fmt:formatDate> only value property is required. It is used to specify the value to be formatted. var and scope attributes <fmt:formatNumber> the role of operations, as they <fmt:formatDate> in the same role.

type value of the property should be number, currency or percentage, and to indicate what type of value to be formatted. The default value of the property is number. pattern attribute priority type property to allow for follow java.text.DecimalFormat class models a more precise value of the agreed format.

When type when the property is currency, currencyCode attribute can be used to explicitly specify the values shown in the currency unit. With the language and country or region code, currency code is the ISO standard management (see the reference for all valid ISO currency symbol code for the link). The code used to determine the value as part of a formatted display of the currency symbol.

In addition, you can use currencySymbol property to explicitly specify the currency symbol. Please note that due to JDK 1.4 and the introduction of class-related java.util.Currency, <fmt:formatNumber> operation currencyCode property priority over currencySymbol property. But in terms of older versions of JDK, currencySymbol property has priority.

maxIntegerDigits, minIntegerDigits, maxFractionDigits and minFractionDigits attributes used to control the display before and after the decimal point the number of digits. These attributes require an integer value.

groupingUsed property with a Boolean value and to control whether to block the number before the decimal point. For example, in the English language environment, the larger numbers into a set of three digits each, each with a comma delimited. Other language environment to use a period or a space-bound this group. The default value of the property true.

Listing 3 shows a simple example of currency, which itself is an extension of the list. In this case, do not specify currencyCode or currencySymbol property. The currency is determined by the locale settings.

Listing 3. <fmt:formatNumber> Tag display currency values using the

<table>
<fmt:timeZone value="US/Eastern">
<c:forEach items="${entryList}" var="blogEntry"
varStatus="status">
<c:if test="${status.first}">
        <tr><td align="left">
          <fmt:formatDate value=
              "${blogEntry.created}" dateStyle="full"/>
        </td></tr>
      </c:if>
      <tr><td align="left">
        <c:out value="${blogEntry.title}" escapeXml="false"/>
      </td></tr>
    <tr><td align="left">
      <c:out value="${blogEntry.text}" escapeXml="false"/>
      <font>
        [My <fmt:formatNumber value="0.02" type="currency"/>
         posted at <fmt:formatDate value="${blogEntry.created}"
                                   pattern="h:mm a zz"/>]
      </font>
    </td></tr>
  </c:forEach>
  </fmt:timeZone>
</table>

en_US locale output shown in Figure 5:

fr_CA locale output shown in Figure 6:

As shown below, <fmt:parseNumber> operation, a numerical analysis, this value is through value property or the operation of the tag body content locale-specific manner, will result as java.lang.Number instance of the class to return. type and pattern attributes <fmt:parseNumber> and <fmt:formatNumber> play the same role. Similarly, parseLocale, var and scope attributes <fmt:parseNumber> from the same role with the <fmt:parseDate>.

<fmt:parseNumber value="
        expression"
    type="
        type" pattern="
        expression"
    parseLocale="
        expression"
    integerOnly="
        expression"
    var="
        name" scope="
        scope"/>
<fmt:parseNumber
    type="
        type" pattern="
        expression"
    parseLocale="
        expression"
    integerOnly="
        expression"
    var="
        name" scope="
        scope">

        body content
</fmt:parseNumber>

Description of previous relevant <fmt:parseDate> also applies to <fmt:parseNumber>: parsing the data is not very suitable for the presentation layer of a task. If the parsing and validation data as part of the application business logic implementation, then the software maintenance will be simplified. For this reason, we usually recommend the product to avoid using both JSP pages <fmt:parseDate> and <fmt:parseNumber>.

Only integerOnly unique property is <fmt:parseNumber>. The property gets a Boolean value that indicates whether the value should be given only to resolve the integer part. If the property is true, then ignore the string to be parsed with any number after the decimal point. The default value of the property false.

Message tag

Achieved using JSTL tags in the text <fmt:message> localization. This tag allows you to locale-specific resource bundle text messages retrieved and displayed on the JSP page. Moreover, since the operation provided by java.text.MessageFormat class features, so you can replace the value of the parameter of the text message into this in order to dynamically customize the localized content.

Used to store locale-specific message resource bundle or properties file using the form class, these classes or properties files to standard naming convention, in which names and naming conventions in the locale name of the base together. For example, the characteristics of the file named Greeting.properties, which resides in our weblog application class path, class path in the package with the com.taglib.weblog corresponding subdirectory. You can specify the same directory, two new properties file, which describes the properties file resource bundle localized for English and French, through the appropriate language code appended to name. Specifically, these two files should be named Greeting_en.properties and Greeting_fr.properties. If you want another localized for Canadian French, you can introduce the third property file, in its name contains the appropriate country code (eg Greeting_fr_CA.properties).

These files are the same features can be defined, but the value of these properties should be tailored to the corresponding language or dialect. This method as shown in Listing 4 and Listing 5, which gives Greeting_en.properties and Greeting_fr.properties sample content files. In these examples, defines two localized news. They can com.taglib.weblog.Greeting.greeting and com.taglib.weblog.Greeting.return key identification. However, these keys have been associated with the value of the localization is determined by the file name in the language. Please note that the message appears in the com.taglib.weblog.Greeting.greeting {0} patterns of the two values that have been parameterized values can be generated dynamically during the content inserted into the message.

Listing 4. Greeting_en.properties content localized resource bundle

com.taglib.weblog.Greeting.greeting=Hello {0}, and welcome to the JSTL Blog.
com.taglib.weblog.Greeting.return=Return

Listing 5. Greeting_fr.properties content localized resource bundle

com.taglib.weblog.Greeting.greeting=Bonjour {0}, et bienvenue au JSTL Blog.
com.taglib.weblog.Greeting.return=Retournez

Show that with JSTL localized content, the first step is to specify the resource bundle. To accomplish this task fmt library provides two custom tags: <fmt:setBundle> and <fmt:bundle>, their behavior and described previously <fmt:setTimeZone> and <fmt:timeZone> marked similar. <fmt:setBundle> operation set a default resource bundle for a specific scope <fmt:message> tag to use, and <fmt:bundle> designated mark for the nested body content in all and any resources used <fmt:message> beam operation.

The following code snippet shows <fmt:setBundle> tag syntax. basename attribute is required, it identifies the resource bundle is set to default values. Please note, basename value of the property should not contain any localized suffix or file extension. Listing 4 and Listing 5 shows an example of resource bundle base name com.taglib.weblog.Greeting.

<fmt:setBundle basename="
        expression"
    var="
        name" scope="
        scope"/>

Optional scope property indicates the default resource bundle set by the JSP application scope. If you do not explicitly specify that the property is assumed to be page scope.

If you specify the optional var property, then the property will basename identified by the resource bundle named by the attribute value assigned to the variable. In this case, scope attribute specifies the variable scope; no default resource bundle will be assigned to the corresponding JSP scope.

You use <fmt:bundle> tag (the syntax is shown below) in its content within the scope of the body tag to set the default resource bundle. And <fmt:setBundle>, can only basename property is required. You can use the optional prefix attribute to the operation of any nested <fmt:message> key value specifies the default prefix.

<fmt:bundle basename="
        expression"
prefix="
        expression">

        body content
</fmt:bundle>

Once you have set the resource bundle, the real show to play the role of localized message is <fmt:message> tag. This operation supports two different syntax, depending on whether any nested <fmt:param> tag:

<fmt:message key="
        expression" bundle="
        expression"
    var="
        name" scope="
        scope"/>
<fmt:message key="
        expression" bundle="
        expression"
    var="
        name" scope="
        scope">
  <fmt:param value="
        expression"/>
  ...
</fmt:message>

For <fmt:message>, only key property is required. key used to determine the value of the property in the resource bundle to display what the definition of news.

You can use the bundle attribute to specify an explicit resource bundle, to find the message identified by the key property. Please note that the value of the property must be the actual resource bundle, such as when the specified property <fmt:setBundle> operation var operation given by the resource bundle. <fmt:message> the bundle property does not support string values (such as <fmt:bundle> and <fmt:setBundle> the basename property).

If you specify <fmt:message> the var attributes, generated by the tag assigned to the specified variable text message, rather than writing JSP pages. Typically, the optional attribute used to specify the var scope attribute specifies the variable scope.

When needed you can use <fmt:param> tag attribute to provide text message value parametric values. Alternatively, you can specify the value <fmt:param> tag body content, in which case this attribute is omitted. Regardless of the value of the model parameters appear in the message text in any place designated by the <fmt:param> tag values will be merged into the message retrieved from the resource bundle, this kind of behavior consistent with the java.text.MessageFormat. Because the parameter value can be identified by its subscript, so the order of nested <fmt:param> tag is important.

<fmt:bundle>, <fmt:message> and <fmt:param> marked interaction as shown in Listing 6. Here, <fmt:bundle> marked by two nested <fmt:message> tag specifies the message in which to retrieve the localized resource bundle. This marked the first two <fmt:message> corresponds with the value of a parameter of the message, also appeared for the value of the corresponding <fmt:param> tag.

Listing 6. <fmt:message> Tags to display localized messages using

<fmt:bundle basename="com.taglib.weblog.Greeting">
<fmt:message key="com.taglib.weblog.Greeting.greeting">
<fmt:param value="${user.fullName}"/>
</fmt:message>
  <br>
  <br>
  <center>
    <a href=
      "<c:url value='/index.jsp'/>"><fmt:message
          key="com.taglib.weblog.Greeting.return"/></a>
  </center>
</fmt:bundle>

Listing 7 shows the use of <fmt:bundle> the prefix property; to prefix property provides the value of the operations in the nested <fmt:message> advance automatically added to all key value. Therefore, the equivalent of Listing 6 Listing 7, but use of this convenient list of 7 characteristics, makes it possible to use the mark in two <fmt:message> thumbnail key value.

Listing 7. <fmt:bundle> The prefix attribute of tag <fmt:message>

<fmt:bundle basename="com.taglib.weblog.Greeting"
            prefix="com.taglib.weblog.Greeting.">
<fmt:message key="greeting">
<fmt:param value="${user.fullName}"/>
</fmt:message>
  <br>
  <br>
  <center>
    <a href="<c:url value='/index.jsp'/>"><fmt:message key="return"/></a>
  </center>
</fmt:bundle>

Figure 7 and Figure 8 shows a working fmt library and information related to the tag, showing the list of 7 from the output generated by the code, and the list of list of 4 and 5 in localized resource bundles. Figure 7 shows the first option when the browser environment as a result of the English language.

Figure 8 shows the French locale specified output.

Conclusion

JSTL fmt for the JSP custom tag library developers on the Java platform provides an API for easy international access. Text messages, numeric and date of the language can be used to display environment-sensitive manner, can also be time to adjust to a specific time zone. Can be set from the user's browser automatically determines the language of a particular user environment, or explicitly specified by the page of the language of a particular user environment. Finally, in addition to providing the data used to generate and display formatting operation outside, fmt library also includes the time for parsing the data for the digital and custom tags.

相关文章
  • JSTL Introduction: To explore the core (b) 2010-11-10

    By reading the first article in this series, you have a basic understanding of the JSTL. We describe the use of the expression language (EL) to access data and manipulate data. As you know, as, EL JSTL custom tag is used to give the dynamic value of

  • JSTL Introduction: that is all (c) 2010-11-10

    In previous articles of this series, we discussed the JSTL and Expression Language (EL). We also study the core library as defined by the custom tag. Specifically, in the "JSTL Introduction: The expression language" that we provide a simplified

  • JSTL Introduction: Expression Language (a) 2010-11-10

    JavaServer Pages (JSP) is a standard platform for J2EE presentation layer technology. JSP technology provides for the implementation of calculations (these calculations is used to dynamically generate page content) and scripting elements and actions.

  • JSTL Introduction: Access sql and xml content (d) 2010-11-10

    Web application template type (stereotypical) architecture is divided into three layers: the Web server processes the request, the implementation of business logic, application server and database management of persistent data. Between application an

  • Introduction Chapter JSTL 2010-05-07

    1: jstl Introduction jstl full name: JavaServer Pages Standard Tag Library, Chinese name Jsp Standard Tag library. jstl is a standard, and the library has been customized labels, can be applied to various fields. Such as: basic output, input, process

  • jstl (jsp standard tag library), introduced 2010-04-14

    jstl (jsp standard tag library) description of: a young master ([email protected]) Preface Jsp 1.1 specification from the start, jsp has supported the jsp in the Use custom defined tags, and extensive use of custom labels created a programmer to re

  • jstl tag library description (reproduced) 2010-09-07

    jstl tag library description (reproduced) Articles Category: Java Programming jstl tag library description (reproduced) JSP 1.1 specification from the beginning, JSP to support the use of JSP custom tags, custom labels created the widespread use of t

  • Yong JSTL study notes 2011-10-05

    A, JSTL installation Download address http://jakarta.apache.org/builds/jakarta-taglibs/releases/standard/ , the latest version of the site jstl1.1, software name jakarta-taglibsstandard-current.zip Extracting lib after the jstl.jar, standard.jar copi

  • Jsp / Servlet Chapter 9 review notes ----- custom tag JSP Standard Tag Library and 2010-10-26

    Tag Library: Reason: In the development of JSP, MVC design pattern in the standard, I hope as much as possible not to appear Scriplet (< %....%>), Provided in the JSP tag library called the code, this code can solve the JSP code appears Scriplet sit

  • A basic introduction to JSTL and EL 2010-05-27

    Introduction JSTL and EL can not help but tell us about the standard JSP action element. JSP standard action elements: <jsp:useBean> elements using javabean <jsp:getProperty> a JavaBean component made from a property value, and its response to

  • Introduction and use of JSTL 2010-12-24

    JSTL (JavaServer Pages Standard Tag Library) Including the five tag libraries, JSTL 1.2 the latest version Functional areas URI Prefix Core http://java.sun.com/jsp/jstl/core c Format http://java.sun.com/jsp/jstl/fmt fmt SQL http://java.sun.com/jsp/js

  • Apache java Project Introduction 2009-04-01

    Apache java Project Introduction (2009-02-25 10:21:46) Apache java Project Introduction Recent contact with Jakarta-Common-BeanUtils this Dongdong more so on the Apache Jakarta Project interest, on their official website under the terms of the feelin

  • OGNL, JSTL, STRUTS2 symbol #,$,% tag usage examples 2010-03-22

    Take the value of Session <c:out value="${sessionScope.user.userId}"> </ c: out> <br> <c:out value="${user.userLoginName}"> </ c: out> <br> <s:property value="#session.user.userId"/>

  • JSTL and EL expressions 2010-03-27

    Session of the values obtained <c:out value="${sessionScope.user.userId}"> </ c: out> <br> <c:out value="${user.userLoginName}"> </ c: out> <br> <s:property value="#session.user.userId"/

  • Facelets introduction, the first part of 2010-04-27

    Original: http://www.jsfcentral.com/articles/facelets_1.html Recently use Facelets, see an excellent article to share with you! This is a series of articles on the first part of Facelets Facelets is used to create a JSF application, presentation laye

  • Note the introduction of the label 2010-07-11

    [Size = x-small] <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%> Citation label version of the problem need to pay att

  • jstl the configuration 2010-08-12

    jstl configuration methods: 1, will be copied to the web-inf/lib jstl.jar and under standard.jar can (if only using the EL expression, without reference to these two packages) 2, the head of the introduction of taglib jsp page as follows: <% @ Taglib

  • JSTL custom function 2010-08-30

    Custom function to define a class MyFuctions, method must be static description provided tld file, tld into the WEB-INF or WEB-INF subdirectory in the jsp using taglib for the introduction of the el expression prefix + function names used in way call

  • Standard Tag Library JSTL 2010-10-16

    Introduction JSTL is a continuous improvement of the open source code of the JSP tag library, is the jakarta apache group to maintain. JSTL only run in support of JSP1.2 and Servlet2.3 standard containers, such as tomcat 4.x. But in the upcoming JSP

  • OGNL Language Introduction 2010-10-23

    Source ibm developerWorks Introduction: OGNL is the Object-Graph Navigation Language acronym, from the language point of view: it is a powerful expression language for getting and setting properties of Java ™ objects. OGNL has applications in many ar