⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parametricreplacement.jsp

📁 基于netbeans的java桌面应用程序合集
💻 JSP
字号:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
  <title>JSTL: Formatting/I18N Support -- Parametric Replacement Example</title>
</head>
<body bgcolor="#FFFFFF">
<h3>Parametric Replacement</h3>

<jsp:useBean id="now" class="java.util.Date" />

<fmt:setLocale value="de"/>
<fmt:setBundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="deBundle"/>

<fmt:formatDate value="${now}" type="both" var="currentDateString"/>
<fmt:parseDate value="${currentDateString}" type="both" var="currentDate"/>

<ul>
 <li> Using single &lt;param&gt; with 'value' evaluating to String:<br>
  <fmt:message key="currentTime" bundle="${deBundle}">
   <fmt:param value="${currentDateString}"/>
  </fmt:message>
 
 <li> Using single &lt;param&gt; with 'value' evaluating to <tt>java.util.Date</tt>:<br>
  <fmt:message key="currentTime" bundle="${deBundle}">
   <fmt:param value="${currentDate}"/>
  </fmt:message>

 <li> Using single &lt;param&gt; with body:<br>
  <fmt:message key="currentTime" bundle="${deBundle}">
   <fmt:param>
    <fmt:formatDate value="${now}" type="both"/>
   </fmt:param>
  </fmt:message>

 <li> Using multiple parameters:<br>
  <fmt:message key="serverInfo" bundle="${deBundle}">
   <c:forEach var="arg" items="${serverInfoArgs}">
    <fmt:param value="${arg}"/>
   </c:forEach>
  </fmt:message>
</ul>

<ul>
 <fmt:setLocale value="es"/>
 <fmt:setBundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="esBundle"/>
 <li>Locale set to Spanish yields a locale-less localization context. Formatting still done
     using the preferred locale:<br>
  <fmt:message key="currentTime" bundle="${esBundle}">
   <fmt:param value="${currentDate}"/>
  </fmt:message>
 </li>

 <fmt:setLocale value="en"/>
 <fmt:setBundle basename="org.apache.taglibs.standard.examples.i18n.Resources" var="enBundle"/>
 <li>Locale set to English yields a locale-less localization context. Formatting still done
     using the preferred locale:<br>
  <fmt:message key="currentTime" bundle="${esBundle}">
   <fmt:param value="${currentDate}"/>
  </fmt:message>
 </li>
</ul>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -