cancel
Showing results for 
Search instead for 
Did you mean: 

Read URL Paramter on application startup in SAPUI5

Former Member
0 Kudos
5,389

Hello Gurus,

                       I think this should be straight forward , So I have index.html file which I call to load my application, Now If I append any other parameters and try that in my browser  I get HTTP 404 error.


for e.g. localhost:8080/index.html/?param="XYZ"

So I would like to know what I need to do in my application to enable it to read URL parameters  any code example would really be helpful.

Thanks

Somil

Accepted Solutions (1)

Accepted Solutions (1)

former_member190010
Contributor
0 Kudos

Hi Somil,

There is a method in SAPUI5:

var sValue = jQuery.sap.getUriParameters().get("myUriParam"); 

Check the following method for a detailed explanation:

https://scn.sap.com/thread/3511676

Regards,

Emanuel

Former Member
0 Kudos

Well I have gone through that but It doesn't work for me. I am yet to find out why.

Could you please throw some light on where to put this code I have tried to put this in Component.js OnInit() method as well.

I am using Eclipse IDE jetty server and when I hit the URL with /index.html/?param="xyz"

It says HTTP 404

Thanks for your help Emanuel

Former Member
0 Kudos

Thanks Emanuel , Is there a way that I can read the POST parameters as well?

fredericorocha
Explorer
0 Kudos

Hello Somil,

POST data is handled on the server side. JavaScript (SAPUI5) is client side. So there is no way you can read a POST parameter.

Regards,

Frederico

Former Member
0 Kudos

Well, What I mean is HTTP Header Parameters , Like SM_USER etc, I need to get the userid and need to read this parameter for that.

fredericorocha
Explorer
0 Kudos

Answers (0)