gudii9
asked on
bean setter from jsp page
hi,
when you declare bean setter as below from jsp page
<jsp:useBean id="sBean" class="cs.BB"
scope="application/page/se ssion/requ est" />
<jsp:setProperty name="sBean" property="*" />
what values does it set with.
I see sBean has some default values.
While getting in jsp as below does it get default values
<jsp:getProperty name="sBean" property="gWith" /></H2>
how does changing scopes like application/page/session/r equest
change the output?
Please advise.
Any links resources ideas highly appreciated. Thanks in advance
when you declare bean setter as below from jsp page
<jsp:useBean id="sBean" class="cs.BB"
scope="application/page/se
<jsp:setProperty name="sBean" property="*" />
what values does it set with.
I see sBean has some default values.
While getting in jsp as below does it get default values
<jsp:getProperty name="sBean" property="gWith" /></H2>
how does changing scopes like application/page/session/r
change the output?
Please advise.
Any links resources ideas highly appreciated. Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Text from the same link:
The availability of a JSP object for use from a particular place of the application is defined as the scope of that JSP object. Every object created in a JSP page will have a scope. Object scope in JSP is segregated into four parts and they are page, request, session and application.
page
‘page’ scope means, the JSP object can be accessed only from within the same page where it was created. The default scope for JSP objects created using <jsp:useBean> tag is page. JSP implicit objects out, exception, response, pageContext, config and page have ‘page’ scope.
request
A JSP object created using the ‘request’ scope can be accessed from any pages that serves that request. More than one page can serve a single request. The JSP object will be bound to the request object. Implicit object request has the ‘request’ scope.
session
‘session’ scope means, the JSP object is accessible from pages that belong to the same session from where it was created. The JSP object that is created using the session scope is bound to the session object. Implicit object session has the ‘session’ scope.
application
A JSP object created using the ‘application’ scope can be accessed from any pages across the application. The JSP object is bound to the application object. Implicit object application has the ‘application’ scope.
The availability of a JSP object for use from a particular place of the application is defined as the scope of that JSP object. Every object created in a JSP page will have a scope. Object scope in JSP is segregated into four parts and they are page, request, session and application.
page
‘page’ scope means, the JSP object can be accessed only from within the same page where it was created. The default scope for JSP objects created using <jsp:useBean> tag is page. JSP implicit objects out, exception, response, pageContext, config and page have ‘page’ scope.
request
A JSP object created using the ‘request’ scope can be accessed from any pages that serves that request. More than one page can serve a single request. The JSP object will be bound to the request object. Implicit object request has the ‘request’ scope.
session
‘session’ scope means, the JSP object is accessible from pages that belong to the same session from where it was created. The JSP object that is created using the session scope is bound to the session object. Implicit object session has the ‘session’ scope.
application
A JSP object created using the ‘application’ scope can be accessed from any pages across the application. The JSP object is bound to the application object. Implicit object application has the ‘application’ scope.
ASKER
>> page
>> ‘page’ scope means, the JSP object can be accessed only from within the same page >>where it was
JSp Object mentioned in the link means sBean in my example right? please advise
<jsp:useBean id="sBean" class="cs.BB"
scope="application/page/se ssion/requ est" />
>> ‘page’ scope means, the JSP object can be accessed only from within the same page >>where it was
JSp Object mentioned in the link means sBean in my example right? please advise
<jsp:useBean id="sBean" class="cs.BB"
scope="application/page/se
Yes, you are correct
ASKER