Hello Yuri,

Another idea is to select the sub component with a session scope
variable, like in the following code sketch.  This is incomplete.  In a
real program the ServerSessionState *sss would be looked up in a map
keyed by say a session number of by client ip / port.

Or if there is a concern about the client modifying the page_no
session scope cookie, then the page_no could instead by stored in
the ServerSessionState.

Regards, Mark

--------------------------------------------------------------------------------
wizard.ecpp:
--------------------------------------------------------------------------------
<%pre>
#include "ServerSessionState.h"
</%pre>

<%session scope="page">
int page_no;
</%session>

<%cpp>
ServerSessionState *sss = (ServerSessionState *)0;
switch(page_no)
{
  case 0:
  default:
  {
</%cpp>
  <& page0(sss_p = sss) qparam&>
<%cpp>
  }
  break;
  case 1:
  {
</%cpp>
  <& page1(sss_p = sss) qparam&>
<%cpp>
  }
  break;
  case 2:
  {
</%cpp>
  <& page2(sss_p = sss) qparam&>
<%cpp>
  }
  break;
}
</%cpp>

<%def page0>
<%param>
ServerSessionState *sss_p; // define a named parameter
</%param>
<html>
 <head>
  <title>page0</title>
 </head>
 <body>
  <h1>page0</h1>
 </body>
</html>
<%cpp>
page_no = 1;
</%cpp>
</%def>

<%def page1>
<%param>
ServerSessionState *sss_p; // define a named parameter
</%param>
<html>
 <head>
  <title>page1</title>
 </head>
 <body>
  <h1>page1</h1>
 </body>
</html>
<%cpp>
page_no = 2;
</%cpp>
</%def>

<%def page2>
<%param>
ServerSessionState *sss_p; // define a named parameter
</%param>
<html>
 <head>
  <title>page2</title>
 </head>
 <body>
  <h1>page2</h1>
 </body>
</html>
<%cpp>
page_no = 0;
</%cpp>
</%def>
--------------------------------------------------------------------------------
ServerSessionState.h
--------------------------------------------------------------------------------
#ifndef SERVER_SESSION_STATE_H
#define SERVER_SESSION_STATE_H

class ServerSessionState
{
  int something;

public:
  ServerSessionState() :
    something(0)
  {
  }
};

#endif

-- 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to