आपकी ऑफलाइन सहायता

BACK
49

सी प्रोग्रामिंग

149

पाइथन प्रोग्रामिंग

49

सी प्लस प्लस

99

जावा प्रोग्रामिंग

149

जावास्क्रिप्ट

49

एंगुलर जे.एस.

69

पी.एच.पी.
माय एस.क्यू.एल.

99

एस.क्यू.एल.

Free

एच.टी.एम.एल.

99

सी.एस.एस.

149

आर प्रोग्रामिंग

39

जे.एस.पी.





डाउनलोड पी.डी.एफ. ई-बुक्स
JSTL - jstl formatting setBundle

<prefix:setBundle> tag ये resource bundle को किसी scope variable पर store करने के लिए इस्तेमाल किया जाता है |


Syntax for <prefix:setBundle> tag in JSTL

<prefix:setBundle basename="Bundle_Name" var="variable_name" scope="scope_name">
<prefix:message------- />
</prefix:setBundle>  

Attributes for <prefix:setBundle> tag in JSTL

basename : यहाँ पर resource bundle name दिया जाता है | bundle name ये package_name.class_name होता है |

var : यहाँ पर variable name दिया जाता है | resource bundle को इस bundle पर store किया जाता है |

scope : Optional. यहाँ पर variable का scope दिया जाता है |


Example for <prefix:setBundle> Tag in JSTL

Sample.java
package myPackage;  
import java.util.ListResourceBundle;  
public class Sample extends ListResourceBundle {  
    public Object[][] getContents() {  
        return contents;  
}
    static final Object[][] contents = {
        { "myfruit.fruit1", "Mango" },
        { "myfruit.fruit2", "Orange" },
    };  
}
index.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>  

<fmt:setBundle basename="myPackage.Sample" var="fruits" />  
	<fmt:message key="myfruit.fruit1" bundle="${fruits}" /><br />  
	<fmt:message key="myfruit.fruit2" bundle="${fruits}" /><br />  
Output :
Mango
Orange