Page Redirection

Top 

A Data Service can decide to redirect the Display Page Service to another page before the current page is generated.

See Data Services.

This can happen typically if a Data Service is unable to produce the data since the data it depends on is not yet available. In this case the Data Service can instruct the Display Page Service to display first the page where the user can input the required information and come back later.

Redirecting in a Data Source Service Class

  import org.moremotion.datasrc.*;
  import org.moremotion.adom.*;
  import org.moremotion.page.*;
 
  public class MyDataService implements DataService {
 
    public void doService(ADOM adom, DataServiceContext dsc)
    throws org.moremotion.servlet.ServiceException {
       //..
       // Check if redirection is required
       try {
         if (isRedirectionRequired()) {
           ADOMException.redirect("OtherPage");
         }
      } catch(Exception ex){
      }
    }
  } 

 
When Display Page Service catches ADOMException.redirect() call, it creates an ADOM named "nextpage" which contains a node named "page". The page node keeps the name of the current page. This will be used to return to the current page after the redirected page is displayed.

 

  <nextpage>
    <page>CurrentPage</page>
  </nextpage>

 

There should be a link on the redirected page, e.g. Continue... with the link value

    display.doms?pg=$vof(/nextpage/page)