>Yes ,
>
>This is obvious.Because, the include directive includes the data of the
>specified file, with-out parsing.Since,parsing is dont after inclusion, this
>error is obvious.

No. The include directive includes the content of the named file
at page compilation time. The content is parsed as if it is
listed in the file (except overlapping jsp commands).
JSP Spec 1.0 (and 1.1) forbids more than one definition of the same ID,
so thats the error we see below.

To solve the problem you can
move the instantiation of the bean to a jsp-fragment
which is included by all paged which need to access it.
Or you may check if your bean exists via pageContext.getAttribute()
and if it doesn't do a <jsp:include> on a jsp page/fragment creating it.

But both versions smell ...

>
>But,certainly its a good idea to include the output of a jsp page in another
>jsp.

That can be done via <jsp:include> tag. (Spec 1.0)

>Probably JSP1.2 should do it!!
>
>-Ram
>
>Mike Cannon-Brookes wrote:
>
>> I thought this was the case too, but running the file combination below
>> yields...
>>
>> *** Error: Duplicate declaration of local variable "MB"
>>
>> Ideas guys? I know you can't redefine a local variable twice, but how can I
>> 'check' if it's defined first? ;)
>>
>> Cheers,
>> Mike
>>
>>  __
>> |  | The BookmarkBox
>> |  | http://www.bookmarkbox.com
>> |/\| Manage and share your bookmarks online!
>>
>> Have you seen our new forums? http://www.bookmarkbox.com/ubbcgi
>> Share your bookmarking with others and get helpful tips!
>>
>> -----Original Message-----
>> From: A mailing list about Java Server Pages specification and reference
>> [mailto:[EMAIL PROTECTED]]On Behalf Of Ramgopal Mudigonda
>> Sent: Monday, 27 September 1999 6:38
>> To: [EMAIL PROTECTED]
>> Subject: Re: Working out if a bean has been instantiated?
>>
>>     Hi Mike,
>>
>> My understanding is, if the bean instance does not exists, then it will be
>> created.Otherwise the the existing instance is used.
>>
>> In your case also same is the answer.
>>
>> -Ram
>>
>> Mike Cannon-Brookes wrote:
>>
>> > G'day guys,
>> >
>> > How can I work out if a bean has been instantiated?
>> >
>> > ie -
>> >
>> > fileA.jsp :
>> > <jsp:useBean id="MB" class="MyBean" scope="application"/>
>> > <%@ include file="fileB.jsp"%>
>> >
>> > fileB.jsp :
>> > <jsp:useBean id="MB" class="MyBean" scope="application"/>
>> >
>> > Sometimes fileB.jsp is included in a file where the bean has already been
>> > used, hence the variable exists. Othertimes, fileB will be the first to
>> use
>> > the bean, and will hence create the pointer to it.
>> >
>> > Any ideas?
>> >
>> > Cheers,
>> > Mike
>> >  __
>> > |  | The BookmarkBox
>> > |  | http://www.bookmarkbox.com
>> > |/\| Manage and share your bookmarks online!
>> >
>> > Have you seen our new forums? http://www.bookmarkbox.com/ubbcgi
>> > Share your bookmarking with others and get helpful tips!
>> >
>> >
>> ===========================================================================
>> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>> JSP-INTEREST".
>> > FAQs on JSP can be found at:
>> >  http://java.sun.com/products/jsp/faq.html
>> >  http://www.esperanto.org.nz/jsp/jspfaq.html
>>
>> ===========================================================================
>> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>> JSP-INTEREST".
>> FAQs on JSP can be found at:
>>  http://java.sun.com/products/jsp/faq.html
>>  http://www.esperanto.org.nz/jsp/jspfaq.html
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html

Ciao,
        Carsten Heyl

  Carsten Heyl                          [EMAIL PROTECTED]
  NADS - Solutions on Nets              http://www.nads.de/
  NADS GmbH                             http://www.pixelboxx.de/
  Hildebrandtstr. 4E                    Tel.: +49 211 933 02-90
D-40215 Duesseldorf                     Fax.: +49 211 933 02-93

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to