JSP Standard Actions

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email
JSP 1. 1 defines some standard action types that are always available, regardless of the version of the JSP engine or Web server the developer uses. The standard action types are in addition to any custom types specific to a given JSP (must be introduced via a taglib directive).

<jsp:forward> forwards a client request to an HTML file, JSP file, or servlet for processing.

The <jsp:forward> element forwards the request object containing the client request information from one JSP file to another file. The target file can be an HTML file,
another JSP file, or a servlet, as long as it is in the same application context as the forwarding JSP file.

You can pass parameter names and values to the target file by using a <jsp:param> clause. An example of this would be passing the parameter name username (with name="username") and the value kichu (with value="kichu") to a servIet login file as part of the request.

Be careful when using <jsp:forward> with unbuffered output. If you have used the <%@ page %> directive with buffer=none to specify that the output of your JSP file should not be buffered, and if the JSP file has any data in the out object, using <jsp:forward> will cause an I I lega I State Exception.

JSP Syntax

<jsp:forward page= {"relative URL " / "<%= expression %>"}/>

or

<jsp:forwardpage={"relativeURL" / "<%= expression % >"}/>

<jsp:param name='ParameterName"

value="(parameterValue / <%=expression %>}'/>+

</jsp:forward>

 

Attributes

page="IrelativeURL 1 <%= expression %>)"

A String or an expression representing the relative URL of the file to which you are forwarding the request. The file can be another JSP file, a servIet, or any other dynamic file that can handle a request object.

The relative URL looks like a path it cannot contain a protocol name, port number, or domain name. The URL can be absolute or relative to the current JSP file. If it is
absolute (beginning with a /) the path is resolved by your Web or application server.

<jsp:param name="parameterName" value="{parameterValue 1 < %= expression

Sends one or more a/value pairs as parameters to a dynamic file. The target file should be dynamic, that is, a JSP file, servlet, or other file that can process the data that is sent to it as parameters.

You can use more than one <jsp:param> clause if you need to send more than one parameter to the target file. The name attribute specifies the parameter name and takes a case sensitive literal string as a value. The value attribute specifies the parameter value and takes either a case sensitive literal string or an expression that is evaluated at request time. The following example illustrates the use of <jsp .forward/>
<jsp:include> includes either a static or dynamic file in a JSP file.

Description

The <jsp:include> element allows you to include either a static or dynamic file in a JSPfile. The results of including static and dynamic files are quite different. If the file is static, its content is included in the calling JSP file. If the file is dynamic, it acts on a request and sends back a result that is included in the JSP page. When the include action is finished, the JSP container continues processing the remainder of the JSP file.

You cannot always determine from a pathname if a file is static or dynamic. For example, http://server:8080/index.html might map to a dynamic servIet through a Web server alias. The <isp:include> element handles both types of files, so it is convenient to use when you don't know whether the file is static or dynamic.

If the included file is dynamic, you can use a <jsp:param> clause to pass the name and value of a parameter to the dynamic file. As an example, you could pass the string username and a user's name to a login form that is coded in a JSP file.

JSP Syntax

<jsp:inc1udepage="{relativeURL / <%= expression %>}"flush="true"/>

or

<jsp:include page="{relativeURL / <%= expression %>}" flush="true">

<jsp. param name= "parameterName'value='IparameterValue / <%= expression

</jsp:include>



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.