Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why can't we access variables from the parent page in Dyanamic Include?

 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand when we include a page dyanamically, the output of the included page is included in the parent page at run time.

Now why the included page can't be able to access the varibles declared in the parent page? Any way jsp container knows the variables in the parent page in advance at run time? So why the included page is restricted to access them?

Please give me some ideas
Regards
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no "parent" and "child". The two are separate processes, separate servlets, separate threads.
It's quite possible they will run in parallel...

It's like saying why a program running on your computer has no access to private data members of a program running on my computer.
 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say A included B,
Variables defined A have the scope of A's service method. So we cannot access A's variables in B's service method.

As Jeoren said �the two are separate processes, separate servlets, separate threads�
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since a dynamically included page shares the includer's request object, you can use that to pass any variables you need to, right?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!