get handle to the next and previous view of the train model

Add the following jstl function library to the jsp:root tag


and proceed with

text="goto page# #{fn:substringAfter( ,'@')}"
text="goto page# #{fn:substringAfter(controllerContext.currentViewPort.taskFlowContext.trainModel.previous ,'@')}"

some of the values that you can get related to trainModel previous and next actions are


Note: to get the display name from the trainstop you have to manually have the binding for next and previous strings added to the bean and evaluate the text manually like

public class Bean {
    TrainModel train;
    TrainStopModel trainStopModel;
String next;
  String previous;
    public Bean() {
      PageFlowStack stack = StateUtils.getCurrentViewPort().getPageFlowStack();
          if (stack.size() > 0)
            train = stack.peek().getTrainModel();
  public static Object evaluateEL(String el) {
      FacesContext facesContext = FacesContext.getCurrentInstance();
      ELContext elContext = facesContext.getELContext();
      ExpressionFactory expressionFactory =
      ValueExpression exp =
          expressionFactory.createValueExpression(elContext, el,

      return exp.getValue(elContext);
    public void setNext(String next) { = next;

    public String getNext() {

      trainStopModel = train.getNextTrainStop(train.getCurrentTrainStop());  = trainStopModel.getTextAndAccessKey();
        return next;

    public void setPrevious(String previous) {
      this.previous = previous;

    public String getPrevious() {
        if(train != null){
      trainStopModel = train.getPreviousTrainStop(train.getCurrentTrainStop());
          this.previous  = trainStopModel.getActivityId().getLocalActivityId();
        return previous;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s