Skip to Content
author's profile photo Former Member
Former Member

Passing values using pages in Application

Hi Experts,

I am currently learning SAp UI5 from ondemand UI5 sites. Have tried one application in which we are navigating from page 1 to page 2 within one application. Now I want to pass a value say it the name of a person to the next page saying "Hello James". I could not find the way to achieve this.

My requirement:

1)In the first page , I have one label, one text field and one button.

2)In the second page only one label where I want to get the value submitted in the first page.

Does any one have idea on this.

Thanks ,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Aug 18, 2015 at 01:48 AM

    Hi Mohanty,

    If you're using sap.m.NavContainer / sap.ui.core.Routing.Router for the Navigation, you can pass parameters from first view using .to / .navTo method -

    In First Page -

    // For sap.m.NavContainer
    // For sap.ui.core.Routing.Router

    secondView will be your view name

    slide is the transition name

    Mode,Notification and DefectItem are the parameters that I am passing from first view to second view. Once you pass them from first view, you have to fetch those parameters in second view.

    In Second Page -

      onBeforeShow: function(event) {
      var params =;
      if(params.Mode == "ViewInspectionNotifications"){
      var selectedNotificationNo = params.Notification;  //You can fetch "210004532" which is passed from first view
      var selectedDefectItem = params.DefectItem;      //You can fetch "0003" which is passed from first view
    }, this);

    Alternatively, you can try using a global JSON model for whole application and store the data using sap.ui.getCore().getModel().setProperty() method in first view and you can fetch those parameters in second view using sap.ui.getCore().getModel().getProperty() method.


    Sai Vellanki.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Mohanty,

      Here you go -

      Using Parameters Passing through .to method : Plunker - Parameter Values

      Alternatively, you can use a global json model.

      So, whenever you're fetching some values like for example, the sample I provided above which has Product and Weight. So, once you click on the list item you get the values, then you could do

      var oSelectedTitle = "Gladiator MX"; // I have just hardcoded the value, but you will get it dynamically in the application.
      this.getView().getModel().setProperty("/modelData/productName", oSelectedTitle);

      "/modelData/productName" will hold the value through out the application. You can bind it to Label/Text/Input control, any control which supports property binding. For example, take Label control -

      new sap.m.Label({text:"{/modelData/productName}"});


      Sai Vellanki.

  • Posted on Aug 17, 2015 at 01:02 PM
    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Santosh,

      I have been through all these samples but here we are not passing values, its only clearing one view content and placing a new content.

      It would be very much helpful if I can pass values in between views.


  • Posted on Aug 17, 2015 at 01:11 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 17, 2015 at 04:22 PM


    You just have to use a json model to hold the data and you can use it in both the views.

    Both the examples do the job very fine:



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.