Using multiple pages in the same part
Another way to conditionally return different pages is to use multiple Page parts within one Web Connection part. You might consider this approach when the pages are closely related to one another and do not need to be accessed from multiple different places.
Ordinarily, a Web Connection part contains no more than one Page part. Because there is only one Page, VA Smalltalk automatically generates the HTML for that page when a request comes in (unless the request is transferred to another page with Page Wrapper or intercepted with CGI Link Request).
However, a Web Connection part can contain multiple Page parts, just as a VA Smalltalk part can have multiple windows. In this situation, you can conditionally control which of the Page parts will generate HTML when the part is accessed from a browser. This makes it possible for a single Web Connection part to generate different pages in different situations.
When you build a Web Connection part with multiple pages, you must designate one of the pages as the primary part. (Again, this is comparable to the primary part of an ordinary VA Smalltalk part.) By default, the first Page added to a Web Connection part is automatically designated as the primary part. You can choose another part by selecting Make primary part from the pop-up menu of another Page part.
When a request comes in for a part containing multiple pages, VA Smalltalk automatically generates HTML for the primary part unless you specifically trigger the generateHTML action of a different part. You can do this by making connections from the events of Form Data or from a script that is triggered by CGI Link Request.
If there is not a Page part designated as the primary part, at run time the browser will display an error message reading No content was generated for this request. If this happens, you need to designate a primary part in your Web Connection part.
Last modified date: 01/29/2015