`
dickyzhu
  • 浏览: 111858 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

EL Implicit Objects and JSP Implicit Objects

 
阅读更多
JSP Implicit Objects : Implicit objects in jsp are the objects that are created by the container automatically and the container makes them available to the developers, the developer do not need to create them explicitly. Since these objects are created automatically by the container and are accessed using standard variables; hence, they are called implicit objects. The implicit objects are parsed by the container and inserted into the generated servlet code. They are available only within the jspService method and not in any declaration. Implicit objects are used for different purposes. Our own methods (user defined methods) can't access them as they are local to the service method and are created at the conversion time of a jsp into a servlet. But we can pass them to our own method if we wish to use them locally in those functions. There are nine implicit objects. Here is the list of all the implicit objects: Object Class application javax.servlet.ServletContext config javax.servlet.ServletConfig exception java.lang.Throwable out javax.servlet.jsp.JspWriter page java.lang.Object PageContext javax.servlet.jsp.PageContext request javax.servlet.ServletRequest response javax.servlet.ServletResponse session javax.servlet.http.HttpSession Application: These objects has an application scope. These objects are available at the widest context level, that allows to share the same information between the JSP page's servlet and any Web components with in the same application. Config: These object has a page scope and is an instance of javax.servlet.ServletConfig class. Config object allows to pass the initialization data to a JSP page's servlet. Parameters of this objects can be set in the deployment descriptor (web.xml) inside the element <jsp-file>. The method getInitParameter() is used to access the initialization parameters. Exception: This object has a page scope and is an instance of java.lang.Throwable class. This object allows the exception data to be accessed only by designated JSP "error pages." Out: This object allows us to access the servlet's output stream and has a page scope. Out object is an instance of javax.servlet.jsp.JspWriter class. It provides the output stream that enable access to the servlet's output stream. Page: This object has a page scope and is an instance of the JSP page's servlet class that processes the current request. Page object represents the current page that is used to call the methods defined by the translated servlet class. First type cast the servlet before accessing any method of the servlet through the page. Pagecontext: PageContext has a page scope. Pagecontext is the context for the JSP page itself that provides a single API to manage the various scoped attributes. This API is extensively used if we are implementing JSP custom tag handlers. PageContext also provides access to several page attributes like including some static or dynamic resource. Request: Request object has a request scope that is used to access the HTTP request data, and also provides a context to associate the request-specific data. Request object implements javax.servlet.ServletRequest interface. It uses the getParameter() method to access the request parameter. The container passes this object to the _jspService() method. Response: This object has a page scope that allows direct access to the HTTPServletResponse class object. Response object is an instance of the classes that implements the javax.servlet.ServletResponse class. Container generates to this object and passes to the _jspService() method as a parameter. Session: Session object has a session scope that is an instance of javax.servlet.http.HttpSession class. Perhaps it is the most commonly used object to manage the state contexts. This object persist information across multiple user connection. The JSP expression language defines various implicit objects: 1.pageContext: The context for the JSP page. It contains the reference of the following objects. .servletContext .session .request .response 2. param: It maps a request parameter name to a single value. 3. paramValues: It maps a request parameter name to an array of values. 4. header: It maps a request header. 5. cookie: It maps a cookie name to a single cookie. 6. initParam: It maps the context initialization parameter name. </jsp-file>
分享到:
评论

相关推荐

    jsp_api.jar

    - **Implicit Objects in Scriptlets**:在脚本块中可以直接使用隐式对象,无需声明。 - **Separation of Presentation and Logic**:鼓励采用Model-View-Controller(MVC)架构,进一步分离视图和业务逻辑。 - **...

    java jsp_ppt

    3. **内置对象(Implicit Objects)**:如`request`、`response`、`session`、`application`等,这些对象由JSP引擎自动创建,提供了与HTTP请求交互的能力。 4. **动作(Actions)**:如`&lt;jsp:include&gt;`, `&lt;jsp:...

    jsp2.0技术手册

    5. **Implicit Objects** JSP 2.0提供了更多的隐式对象,如`pageContext`、`session`、`request`等,使得开发者可以直接在页面上使用这些对象,无需显式声明。 6. **Servlet 2.4 Integration** JSP 2.0与Servlet ...

    JSP第三版课本实例以及实验代码

    4. **Implicit Objects**:JSP页面内预定义了一些对象,如`request`、`response`、`session`等,这些隐含对象简化了对HTTP请求和响应的处理。 5. **Separation of Concerns**:第三版强调了模型-视图-控制器(MVC)...

    JSP中文开发文档 API CHM格式

    1. **基本概念**:解释JSP的基本元素,如指令(directives)、脚本元素(scripting elements)、动作(actions)和隐含对象(implicit objects)。 2. **JSP生命周期**:描述了从页面被请求到响应返回客户端的整个...

    EL表达式.docx

    这些隐含对象(implicit objects)简化了从特定作用域获取变量的步骤,避免了JSP中使用`getAttribute()`方法的繁琐。 4. **自动类型转换**: EL的一个显著优点是其内置的类型转换功能。例如`${param.count + 20}`...

    北大青鸟 accp 5.0 JSP 课件

    1. **JSP基本语法**:了解JSP页面结构,包括指令(Directives)、动作(Actions)和内置对象(Implicit Objects),如request、response、session、application等。 2. **JSP脚本元素**:包括脚本声明...

    《JSP应用开发详解(第三版)》

    12. **JSP 2.0及以上版本的新特性**:如Declarative Attributes、 Implicit Objects、JSP 2.2的scriptless JSP等,这些新特性简化了JSP的开发,提高了代码的整洁度。 本书的非完全版可能没有涵盖所有章节,但上述...

    JSP技术手册和入门教程和语法

    - 变量和对象:隐含对象(Implicit Objects),如request、response、session等。 - JSP与Servlet的关系,以及它们在Web应用中的角色。 - 使用EL(Expression Language)进行数据绑定和表达式求值。 3. **JSP...

    jsp最新学习资料

    4. **Implicit Objects**:默认提供了一些对象,如`pageContext`, `session`, `request`, `response`, `out`, `config`, `application`, `exception`,方便开发者使用。 5. **New scriplets syntax**:鼓励使用EL和...

    JSP七个小项目代码和笔记汇总(java web).rar

    JSP的核心概念包括:指令(Directives)、脚本元素(Scripting Elements)、动作(Actions)和内置对象(Implicit Objects)等。通过这些元素,开发者可以轻松地创建数据驱动的动态网页。 2. **Servlet与JSP的关系*...

    JSP 2.0技术手册

    - **Implicit Objects的增强**:例如`pageContext`对象提供了更多的功能,如获取请求参数和管理作用域。 - **Standard Action的改进**:如`&lt;jsp:useBean&gt;`现在可以自动实例化和初始化JavaBeans。 **4. JSP与Servlet...

    jsp视频学习教程地址

    JSP通过使用指令(Directives)、脚本元素(Scripting Elements)以及内置对象(Implicit Objects)来实现动态生成网页。例如,`&lt;jsp:include&gt;`指令用于包含其他页面,`&lt;jsp:useBean&gt;`则用于实例化JavaBean。 【JSP...

    JSP+ORACLE数据库组建动态网站经典案例

    1. **JSP基本语法**:包括指令(directives)、动作(actions)、内置对象(implicit objects)如request、response、session等,以及EL(Expression Language)和JSTL(JavaServer Pages Standard Tag Library)的...

    JSP _用教程.zip

    3. **内置对象(Implicit Objects)**:JSP提供了一系列预定义的对象,如`request`, `response`, `session`, `application`, `pageContext`, `out`, `page`, 和`config`,这些对象简化了对HTTP请求、响应、会话管理...

    留言板jsp +javabean

    JSP的核心概念包括:指令(Directives)、动作(Actions)、脚本元素(Scripting Elements)以及内置对象(Implicit Objects)。在这个留言板项目中,JSP将用于展示用户界面,处理表单提交,并与后台JavaBean进行...

    JSP入门与提高(含源码)

    4. **内置对象(Implicit Objects)**:JSP提供了一系列内建的对象,如`request`, `response`, `session`, `pageContext`等,可以直接在JSP页面中使用,无需创建。 **JSP生命周期**: 1. **加载**:当JSP首次被请求...

    JSP Simple Examples

    This package is imported in the jsp page so that the Date class and its properties can accessed in the JSP page. If- Else Ladder A ladder means a vertical set of steps. It is a computer generated ...

    JSP简明教程-简单扼要易懂

    7. **内置对象(Implicit Objects)** - JSP提供了一些预定义的对象,可以直接使用而无需声明。 - 常用的有:`request`、`response`、`session`、`application`等。 #### 四、JSP页面的生命周期 - **初始化阶段**...

    门户网站(实训项目)

    1. **JSP基本结构**:理解JSP页面的基本组成,包括指令(Directives)、脚本元素(Scripting Elements)、动作(Actions)以及内置对象(Implicit Objects),这些是编写JSP页面的基础。 2. **JSP到Servlet转换**:...

Global site tag (gtag.js) - Google Analytics