Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

JSP scripting elements – PB Docs 110 – PowerBuilder Library

JSP scripting elements – PB Docs 110

JSP scripting elements

Scripting elements manipulate
objects and perform computations. The character sequence that precedes
a scripting element depends on the element’s type: <% for
a scriptlet, <%= for
an expression, and <%! for
a declaration. Scriptlets, expressions, declarations, and server-side
comments are all closed with the sequence %>.

Scriptlets

A scriptlet contains
a code fragment valid in the page-scripting language (usually Java,
but other languages can be defined in the page directive):

Expressions

An expression contains an expression valid in the page-scripting
language:

Declarations

A declaration declares
variables or methods valid in the page-scripting language:

Comments

You can add two types
of comments to a JSP file:

  • HTML comments optionally
    contain an expression. They are sent to the client and can be viewed
    in the page source:

  • Hidden comments document the source file and are
    not sent to the client:

To insert a comment, type it in the Source view.

Inserting a scripting element

proc.gif To insert a scripting element in a JSP page:

  1. Open a JSP page, select the Page tab, and
    right-click in the Script editor.

  2. From the pop-up menu, select New Script>Server>JSP
    and then the delimiters for the type of scripting element you want.

    script1.gif

  3. Type the script, expression, or declaration in
    the Script editor.

Implicit objects

When a JSP page processes
a request, it has access to a set of implicit objects, each of which
is associated with a given scope. Other objects can be created in scripts.
These created objects have a scope attribute that defines where
the reference to that object is created and removed.

References to an object created in script are stored in the pageContext, request, session,
or application implicit object, according to
the object’s scope.

Table 6-1: Implicit objects for a JSP target
Implicit object Description Scope
request The request triggering the servlet invocation. Request
response The response to the request that triggered
the servlet invocation.
Page
pageContext The page context for this JSP. Page
session The session object created for the requesting client
(if any).
Session
application The servlet context obtained from the
servlet configuration, as in the call getservletConfig().getContext().
Application
out An object that writes to the output stream. Page
config The ServletConfig instance
for this JSP.
Page
page The instance of this page’s
implementation class that is processing the current request. A synonym
for this when the programming language
is Java.
Page
exception The uncaught Throwable exception
that caused the error page to be invoked.
Page

Implicit objects display on the Language tab page in the System
Tree.

implobj1.gif

Implicit objects other than the exception object
are always available within scriptlets and expressions. If the JSP
is an error page (the page directive’s isErrorPage attribute
is set to true), the exception implicit object
is also available.

You can often use an implicit object or a Web Target object
model wrapper class to obtain the same functionality. For example,
calling out.println in a server-side
event is equivalent to calling psDocument.Write.

For more information about the exception implicit object,
see “Error handling”.
For more information about server-side events, see “Writing server scripts”.

Scopes

There are four scopes for objects in a JSP application.

Table 6-2: Scopes for objects in a JSP application
Scope Description
Page Accessible only in the page in which
the object is created. Released when the response is returned or
the request forwarded.
Request Accessible from pages processing the
request in which the object is created. Released when the request
has been processed.
Session Accessible from pages processing requests
in the same session in which the object is created. Released when
the session ends.
Application Accessible from pages processing requests
in the same application in which the object is created. Released
when the runtime environment reclaims the ServletContext.

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x