Wednesday, November 11, 2009

Implicit Objects in jsp

Variable
Class
Description
application
The context for the JSP page's servlet and any Web components contained in the same application. See Accessing the Web Context.
config
Initialization information for the JSP page's servlet.
exception
Accessible only from an error page. See Handling Errors.
out
The output stream.
page
The instance of the JSP page's servlet processing the current request. Not typically used by JSP page authors.
pageContext
The context for the JSP page. Provides a single API to manage the various scoped attributes described in Using Scope Objects .
This API is used extensively when implementing tag handlers (see Tag Handlers).
request
The request triggering the execution of the JSP page. See Getting Information from Requests.
response
The response to be returned to the client. Not typically used by JSP page authors.
session
The session object for the client. See Maintaining Client State.

Difference between ServletContext and ServletConfig

ServletContext Defines a set of methods that a servlet uses to communicate with its servlet container.
ServletConfig is a servlet configuration object used by a servlet container used to pass information to a servlet during initialization. All of its initialization parameters can ONLY be set in deployment descriptor.
The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized.
You can specify param-value pairs for ServletContext object in tags in web.xml file.
The ServletConfig parameters are specified for a particular servlet and are unknown to other servlets.
The ServletContext parameters are specified for an entire application outside of any particular servlet and are available to all the servlets within that application.

what is the use of immutable String class in java?...






Immutable means not changeable. when a string is declared and initiated with some values.
Afterwards whenever we will concat that string or change that string. if we r going to add more characters in that string object. it will not allow dynamic size change. to cater such problem when any change will occur in string object the object will be recreated and previous object will be destroyed and new will be created with new size to accomodate change. thats y strings are immutable in java.

Mutable Objects: When you have a reference to an instance of an object, the contents of that instance can be altered
Immutable Objects: When you have a reference to an instance of an object, the contents of that instance cannot be altered