JSP - Custom Tags in JSP
JSP Custom Tags ये user-defined elements होते है | जब इन custom tags को create किया जाता है तब उन्हें directly JSP Page पर insert किया जाता है |
Custom Tags Advantages
- JSP Custom Tags ये JSP Page से business logic को seperate करने की अनुमति देता है |
- Custom Tags Scriptlet tag(<%--%>) की जरूरतों को हटा देता है |
- Custom Tags को एक ही JSP Page पर बार-बार इस्तेमाल कर सकते है | इसकी वजह से एक ही jsp code को बार-बार दोहराने की जरुरत नहीं पड़ती है |
Difference Between HTML Tags and JSP Custom Tags
जब HTML Page create करके Browser पर execute किया जाता है तब उस page का source code जैसे-तैसे उसके view source code(ctrl+u) पर दिख जाता है |
अगर Custom Tags की बात करे तो view source code(ctrl+u) पर इन Tags को नजरअंदाज किया जाता है | इससे JSP Coding काफी secure रहते है |
Types of Custom Tags
Empty Custom Tags :
Empty Custom Tags के लिए कोई body या attributes नहीं होते है |
Syntax :<prefix:tagname /> or <prefix:tagname> ----- </prefix:tagname>
Classic Custom Tags :
Empty Custom Tags के लिए कोई body या attributes होते है |
Syntax :<prefix:tagname attr1=value1,attr2=value2,...,attrN=valueN /> or <prefix:tagname attr1=value1,attr2=value2,...,attrN=valueN> ----- </prefix:tagname>