huanghongbo

在实际的需求中,我们往往会遇到在下一步的时候验证某些参数,而上一步不需要验证。 

 

这个是非常粗暴的解决方式

 if( "goto".equals(pageContext.getParameter(EVENT_PARAM) ){
         OATrainBean trainBean = 
      (OATrainBean)pageContext.getPageLayoutBean().getLocation();
    int target = Integer.parseInt(pageContext.getParameter(VALUE_PARAM)); //获取目标页面所处的节点,从1开始,第一个页面为1
    int step = trainBean.getSelectedTrainStepRenderedIndex()==0?0:trainBean.getSelectedTrainStepRenderedIndex();//获取当前页面所处的节点,从1开始,(我有点不太确定这段解释是否正确)
    
    int k = trainBean.getNumberOfRenderedTrainSteps();//获取当前交互式列车的总页面数量
    
    //在实际的应用中,我们一般是知道我点击下一步/上一步会跳转在第几个页面上
    //例如我当前处于第三个页面
    if( target == 4){
        //NEXT
        //下一步
        //write your logic here……
    }
    if( target == 2){
        //上一步        
        //PREVIOUS        
        //write your logic here……
    }
 }

 

这个是非常标准的解决方式

 

if (GOTO_EVENT.equals(pageContext.getParameter(EVENT_PARAM)) && 
            "NavBar".equals(pageContext.getParameter(SOURCE_PARAM))) {
            OATrainBean trainBean = 
                (OATrainBean)pageContext.getPageLayoutBean().getLocation();
            int step = 
                trainBean.getSelectedTrainStepRenderedIndex() == 0 ? 0 : trainBean.getSelectedTrainStepRenderedIndex();
            int target = 
                Integer.parseInt(pageContext.getParameter(VALUE_PARAM));
            if (step + 1 > target) {
                //上一步


            } else {
                //下一步
                
                }

 

 

参考文档

How to catch the \'Next\' button click in a Train Flow

APPLICATION EXTENSION TECHNICAL DESIGN

Problem related to train.

 

 

分类:

技术点:

相关文章:

  • 2022-02-08
  • 2021-06-01
猜你喜欢
  • 2022-02-08
  • 2021-09-18
  • 2021-05-31
  • 2022-12-23
  • 2021-12-01
  • 2021-11-24
  • 2022-03-05
相关资源
相似解决方案