160 likes | 516 Views
JSP Standard Actions. Celsina Bignoli bignolic@smccd.net. JSP Standard Actions. The JSP specification defines a few standard action elements (built-in in JSP) The syntax: <jsp:action-name attr1=“value1” attr2=“value2”> action_body </jsp:action-name> or (with no body)
E N D
JSP Standard Actions Celsina Bignoli bignolic@smccd.net
JSP Standard Actions • The JSP specification defines a few standard action elements (built-in in JSP) • The syntax: <jsp:action-name attr1=“value1” attr2=“value2”> action_body </jsp:action-name> • or (with no body) <jsp: action-name attr1=“value1” attr2=“value2” />
JSP Standard Actions - Example <jsp:forward page=“nextPage.jsp”> <jsp:param name=“aParam” value=“aValue” /> </jsp:forward> <jsp:forward page=“nextPage.jsp” />
<jsp:forward> • passes control to another JSP page or servlet • the execution of the current JSP page is terminated and control is fully passed to the target JSP • Syntax 1: <jsp:forward page=“pagePath” /> • Syntax 2: <jsp:forward page=“pagePath” > <one or more <jsp:param> actions </jsp:forward>
<jsp:include> • includes the response of another JSP page, servlet or static file • the execution of the current JSP page continues after including the response generated by the target resource • the target resource has access to all the parameters and headers passed with the request. • Additional parameters can be passed using <jsp:param> actions in the body of <jsp:include> • Syntax 1: <jsp:include page=“pagePath” /> • Syntax 2: <jsp:include page=“pagePath” > <one or more <jsp:param> actions </jsp:include>
<jsp:plugin> • used to download Java Plugin software and invoke a Java applet • Syntax: <jsp:plugin type=“applet” code=“Code.class” codebase=“relativePath” [jreversion=“jreVersion] [height=“height”] [width=“width”] [hspace=“hSpace”] [vSpace=“vspace”] [iepluginurl=“pluginURL”] [nspluginurl=“pluginURL”] [name=“name”][title=“title”] > Optionally one <jsp:params> action and one <jsp:fallback> action </jsp:plugin>
<jsp:params> • can only be used within the body of a <jsp:plugin> action to enclose a set of <jsp:param> actions that specify the applet parameters • Syntax: <jsp:params> One or more <jsp:param> action </jsp:params>
<jsp:fallback> • can only be used within the body of a <jsp:plugin> • Specifies the template text to use for browser that don’t support the <html> or <object> elements • Syntax: <jsp:fallback> Fallback body </jsp:fallback>
<jsp:plugin> - Example <jsp:plugin type=“applet” code=“Clock2.class” codebase=“applet” jreversion=“1.2” width=“160” height=“160” > <jsp:params> <jsp:param name=“bgcolor” value=“cc00ff” /> </jsp:params> <jsp:fallback> Plugin tag OBJECT or EMBED not supported by the browser </jsp:fallback> </jsp:plugin>
<jsp:attribute> • defines an attribute value for another jsp action • Syntax: <jsp:attribute name=“attrName” > Attribute value </jsp:attribute>
<jsp:body> • defines the body for an action element • Only required when the action attributes are defined using <jsp:attribute> • Syntax: <jsp:body> Body content </jsp:body>
<jsp:body> - Example <jsp:plugin type=“applet” code=“Clock2.class” codebase=“applet” jreversion=“1.2”> <jsp:attribute name=“width”>160</jsp:attribute> <jsp:attribute name=“height”>160</jsp:attribute> <jsp:body> <jsp:params> <jsp:param name=“bgcolor” value=“cc00ff” /> </jsp:params> <jsp:fallback> Plugin tag OBJECT or EMBED not supported by the browser </jsp:fallback> </jsp:body> </jsp:plugin>