「JSTL」fmt:bundleタグでリソースメッセージを取得する

2021年8月19日

タグ属性
basename プロパティファイルの名前

構文
<fmt:setBundle basename="プロパティ名" var="変数名"/>

使用例1

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<fmt:setBundle basename="sample.USER0020" var="res"/>
<th> <fmt:message bundle="${res}" key="labels.uid" /> </th>
<fmt:setBundle basename="sample.USER0020" var="res"/> <th> <fmt:message bundle="${res}" key="labels.uid" /> </th>
<fmt:setBundle basename="sample.USER0020" var="res"/>
<th> <fmt:message bundle="${res}" key="labels.uid" /> </th>

使用例2

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<fmt:bundle basename="application" >
  <fmt:message key="product.id"/><br>
  <fmt:message key="product.name"/><br>
</fmt:bundle>
<fmt:bundle basename="application" >   <fmt:message key="product.id"/><br>   <fmt:message key="product.name"/><br> </fmt:bundle>
<fmt:bundle basename="application" >

  <fmt:message key="product.id"/><br>
  <fmt:message key="product.name"/><br>

</fmt:bundle>

 

JavaScript

Posted by arkgame