There have been many forum questions about the correct usage of the context control in a multiple page web application. I will be the first one to admit that this is more of a bug in the ADF than an incorrect usage on the part of the user. Ok, so the short end of it is this question: How do I access the same context across multiple pages of an ADF web application?
Typically, the context is specified on a JSP using the
<ags:context id="myCtx" resource="myServerObject@myHost"/>
Now, in an ideal world, if you have multiple pages in your webapp, you should have to use the context control in the exact same manner on all other pages and it should work fine. Unfortunately, that's not the case at 9.1. Currently, the way the
contexttag works is that if you specify the
resourceattribute of the tag, the first time that the page is accessed, it actually creates a new context. What this means is that if you use the
contexttag by specifying the
resourceattribute on different pages of the same webapp, it gives an impression that the context is "resetting" itself - i.e. the current state of your application is lost and the application reverts to the original state of the map server object.
A workaround to this problem is that on subsequent pages of your webapp, you should not specify the
resourceattribute of the
contexttag and ensure that the
idis same as the id that you specified on the main page:
<!-- resource attribute is not used and id is same as the id of the context on the main page -->
resourceattribute is not specified, the
contexttag does not create a new context but instead tries to find an existing context with the same id as specified in the
idattribute. So as long as you have the correct id specified, the context that you created on the main page will be accessed on all subsequent pages of the webapp.
This is admittedly confusing and we have addressed it at 9.2 so that the context control can be used in a consistent manner across all pages of the webapp.