Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
As we discussed earlier, Seam creates a new workspace for each HTTP GET request. By definition, the new workspace has its own fresh conversation. So what if we want to do an HTTP GET and still preserve the same conversation context? For instance, you might have a pop-up browser window that shares the same workspace/conversation as the current main window. That’s where the Seam conversation ID comes to help.
If you look at the URLs of the Seam Hotel Booking example application, every page URL is appended with a cid URL parameter. This cid stays constant within a conversation. If the conversation is long running, the URL has an additional clr=true parameter. For instance, a URL in the booking application could look like the this: http://localhost:8080/booking/hotel.seam?cid=10&clr=true.
To GET a page without disrupting the current conversation, you can append the same cid and clr name/value pairs in your HTTP GET URL.
Appending the cid value in URL can be risky business. What if you pass in a wrong value for the cid parameter? Will the application just throw an error? Well, you can also configure the components.xml file to set a default page to forward to when the URL has an unavailable cid value.
<components ...>
... ...
<core:pages
no-conversation-view-id="/main.xhtml"/>
</components>
Of course, manually entering the cid and clr parameters is still not desirable. So to go back to the original question of opening the same workspace in a new window, you need to dynamically render a link with the right parameters already in place. The following example shows you how to build such a link. The Seam tags nested in <h:outputLink> generate the right cid and clr parameters to the link.
<h:outputLink value="main.seam" target="_blank">
<s:conversationId/>
<s:conversationPropagation
propagation="join"/>
<h:outputText value="Open New Tab"/>
</h:outputLink>
Use the <s:link> TagYou can use the Seam <s:link> tag discussed in Section 7.2.5., “Links and Buttons”, to open new browser windows/tabs within the same conversation. |