wood burning stoves 2.0*
The moose likes JSP and the fly likes which ofenclosing page variables can be automatically used by the dyna.included file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "which ofenclosing page variables can be automatically used by the dyna.included file?" Watch "which ofenclosing page variables can be automatically used by the dyna.included file?" New topic
Author

which ofenclosing page variables can be automatically used by the dyna.included file?

Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
can dynamically included files use the implicit variables application, session, request, pageContext , out, response and config?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Have you tried it? What did you discover?
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
Hi bear,
i am at the moment just writing the first technical specs. so i dont have the chance to try...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Well when you get a chance to try, let us know if you find anything confusing.
bear
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

comma, I'm not trying to be obstinate here; I'm trying to make a point. The primary job of a forum bartender is not to enforce the naming convention (much as it seems so), but to make sure that the participants of the forum are getting the most out of it as a resource.
JavaRanch is here to help you help yourself; not to do your work for you. If you are not willing to go the first mile to try and figure something out, why should the people who volunteer their time to help out here do all your leg-work for you?
It will take ten minutes or less for you to set up a set of test JSP pages that you can use to answer your own question. And, I will point out, such verification is part of the research necessary to write tech specs for a project.
Now, if you perform such a test and are puzzled by some of the results, you know you can post such questions here and you will get lots of help from the regular posters -- I've seen you do the same yourself. But you've got to make an effort to help yourself first.
bear
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
Bear,
actually you are right. it has been a while I didnot use the jsp and related technologies. so forgotten some of the features.
sory then. I will set up the old tomcat environment again.
bye
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

That's definitely the best thing to do especially if you are in the process of writing a tech spec for a web app (which is what I am assuming you are trying to do). That way you can perform any little tests to verify your knowledge as you go along. And as I pointed out, please feel free to ask questions about aspects that may confuse you.
thanks,
bear
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

And to help you along (I'm just long-winded today, aren't I?), pay especially close attention to the behavior of the pageContext variable in this scenario.
bear
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
OK, dynamically included files get a reference to the variables of the enclosing page via pageContext, which is in fact the same unique object.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

No. How did you perform this check?
bear
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
i printed the pageContext objects out. they are the same.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

OK, we are talking about <jsp:include> rather than <%@ include %>, right?
bear
[ October 22, 2003: Message edited by: Bear Bibeault ]
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
Of course I tried both of them. pageContext object is the same : in the enclosing page, in the dyn.ly included file, and also statically included page. and this is very logical to me. They 3 are serving for the same request object, which is bound to a pageContext.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

The results you should have found are that for a <jsp:include> that you get different page contexts as well as requests. The whole point of a <jsp:include> is that initiates a separate request for the included resource.
How did you set up your tests?
bear
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
I have an enclosing-page.jsp,
which includes with
and
Then I put also sth. on the request and application scopes, and retrieved them from within the included files.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Brusk Baran:
I have an enclosing-page.jsp,
which includes with
and
Then I put also sth. on the request and application scopes, and retrieved them from within the included files.

AW there is only one application object for one context.
And If I am not wrong then request object has a scope of request and hence remain same for inculded file[for both type i.e. at runtime and at compile time]


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Brusk Baran
Ranch Hand

Joined: Nov 15, 2001
Posts: 132
OK,
it is that.
the enclosing page and the dynamically included files share the request only (apart from session(if any) and application of course. Their pageContext objects are also different.
nevertheless, enclosing page and the statically included files are the same file effectively, which share both the PageContext, request, session, and application. they have the same pageContext object.
I have been closing this topic now.
 
 
subject: which ofenclosing page variables can be automatically used by the dyna.included file?
 
Similar Threads
Sharing of variables
Native methods/member variables
Garbase Collection
final static variables in beans?
Servlet life : when is it safe to use class var's in servlet