所谓scope,是用来指定一个范围:引用这个JavaBean时,如果在这个范围找到了现成的对象,则利用那个现成的对象,如果在这个范围没有找到,则新建一个。

解决方案 »

  1.   

    scope="page|request|session|application"The scope in which the bean exists and the variable named in id is available. The
    default value is page. The meanings of the different scopes are shown below:page You can use the bean within the JSP page with the
    <jsp:useBean> element or any of the page’s static include
    files, until the page sends a response back to the client or
    forwards a request to another resource.request You can use the bean from any JSP page processing the same
    request, until a JSP page sends a response to the client or
    forwards the request to another resource. You can use the
    request object to access the bean, for example, request.
    getAttribute(beanInstanceName).session You can use the bean from any JSP page in the same session as
    the JSP page that created the bean. The bean exists across the
    entire session, and any page that participates in the session can
    use it. The page in which you create the bean must have a page
    directive with session="true".application You can use the bean from any JSP page in the same application
    as the JSP page that created the bean. The bean exists across an
    entire JSP application, and any page in the application can use
    the bean.
      

  2.   

    这是你给我的留言:>>那如果有个bean其中有个方法它带有参数
    >>那这个bean的scope是application的
    >>那我现在想问以下,不同的用户 调用这个方法时参数是不同的,照你这么说
    >>一旦有个用户调用这个页面 就生成了这bean实例 那么其它用户调用时 
    >>它的参数是怎么办的了不是很明白你要做什么。也不懂为什么你会想不通。用不同的参数对方法进行调用可以期待会有不同的结果啊,有什么不清楚的么?搞不懂你为什么期望对不同的用户作不同的操作,scope却坚持要用application。