With reference to HF's
Servlets &
JSP: (pg 385)
One of the reasons you use the scope implicit objects is to avoid a potential naming conflict. How can I have the same id for two useBean tags? When I try to set an attribute with the same name in request scope and session scope using:
<jsp:useBean id="person1" class="com.example.Person" scope="request">
Setting Request Attribute:
<jsp:setProperty name="person1" property="userName" />
</jsp:useBean>
Getting Request Attribute:
<jsp:getProperty name="person1" property="userName" />
<br>
<jsp:useBean id="person1" class="com.example.Person" scope="session">
Setting Session Attribute:
<jsp:setProperty name="person1" property="userName" />
</jsp:useBean>
Getting Session attribute:
<jsp:getProperty name="person1" property="userName" />
I am getting the foll error:
org.apache.jasper.JasperException:jsp.error.useBean.duplicate /CheckAction.jsp
I am trying to create a situation where there is a same-named attribute in 2 different scopes (say request and session) and figure out what it prints with and without using implicit objects. How do I go about it?
(I know I am being a hard-nut, but I just scored 50% in that chapter's mock
and thought I'll be better off trying every silly thing out on the system )
Thanks.
[ February 06, 2006: Message edited by: Sue Pillai ]