JSP Standard Tag(Action Element)
JSP specification provides Standard(Action) tags for use within your JSP pages. These tags are used to remove or eliminate scriptlet code from your JSP page because scriplet code are technically not recommended nowadays. It's considered to be bad practice to put java code directly inside your JSP page.
Standard tags begin with the jsp:
prefix. There are many JSP Standard Action tag which are used to perform some specific task.
The following are some JSP Standard Action Tags available:
Action Tag | Description |
jsp:forward | forward the request to a new page Usage : <jsp:forward page="Relative URL" /> |
jsp:useBean | instantiates a JavaBean Usage : <jsp:useBean id="beanId" /> |
jsp:getProperty | retrieves a property from a JavaBean instance.
Usage :
<jsp:useBean id="beanId" ... />
...
<jsp:getProperty name="beanId" property="someProperty" .../>
Where, beanName is the name of pre-defined bean whose property we want to access. |
jsp:setProperty | store data in property of any JavaBeans instance. Usage :
<jsp:useBean id="beanId" ... />
...
<jsp:setProperty name="beanId" property="someProperty"
value="some value"/>
Where, beanName is the name of pre-defined bean whose property we want to access. |
jsp:include | includes the runtime response of a JSP page into the current page. |
jsp:plugin | Generates client browser-specific construct that makes an OBJECT or EMBED tag for the Java Applets |
jsp:fallback | Supplies alternate text if java plugin is unavailable on the client. You can print a message using this, if the included jsp plugin is not loaded. |
jsp:element | Defines XML elements dynamically |
jsp:attribute | defines dynamically defined XML element's attribute |
jsp:body | Used within standard or custom tags to supply the tag body. |
jsp:param | Adds parameters to the request object. |
jsp:text | Used to write template text in JSP pages and documents. Usage : <jsp:text>Template data</jsp:text> |