cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a parameter to MVC BSP

Former Member
0 Kudos

Hi All,

I am fairly new to this BSP lark and was wondering if anyone could help me. I am wanting to call a BSP created using the MVC techniquies from another web link by passing it a parameter. For example if i had created the BSP without MVC i could just call the .htm page using the following syntax www.examplebsp.htm?gd_id=1234&gd_name=bob. But when using the MVC technique you call the .do controller but i dont seem to be able to pass values to it ( other than using a cookie i guess ).

Is there a way i can do this.

Having said all this, i have just had a thought!..maybe i could create a page with flow logic within the BSP to except the passed parameters and from within here call the controller. Is this a viable option or is there a better way

Thanks in advance

Regards

Mart

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

Ankur , is it not request->get_form_field ?

Mart - > you can read the value passed from the url in your DO_REQUEST method using request->get_form_field or you can also use a flowlogic page to collect the variables passed via url.

Regards

Raja

Former Member
0 Kudos

Excellent cheers Raja,

That has done exactly what i wanted.

Regards

Mart

Former Member
0 Kudos

Hi Raja/Mart,

Yes, that should be request->get_form_field, I missed.

Thanks for pointing.

Thanks & Regards,

Ankur

Former Member
0 Kudos

Thanks again for the help, does anyone know how to remove the ?gd_id=123 bit from the link once i have access the service.

i.e. so within the IE web address field i see www.examplebsp.htm rather than www.examplebsp.htm?gd_id=1234

regards

Mart

athavanraja
Active Contributor
0 Kudos

<i>I am wanting to call a BSP created using the MVC techniquies from another web link by passing it a parameter.</i>

since you are calling this bsp from another web page, you could use a form with POST method.

this would be something like below

<form method="POST"

action="<url for bsp page>">

<input type="text" name="gd_id" value="123" />

<input type="submit" name"s1" value="s1" />

</form>

Regards

Raja

Former Member
0 Kudos

Sorry for the long delay, I have now changed the form method to POST the now the SAP method 'request->get_form_field' no longer retrieves the values, but when I change it back to a 'GET' it does. Is there another method that should be used to retrieve POST values.

thanks in advance

Regards

Mart

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mart,

In ur controller, try using method

request->get_header_field( name = 'gd_id'

value = var ).

Thanks & Regards,

Ankur

Former Member
0 Kudos

Hi Ankur,

Thanks for your rely but unfortunately it did not seem to retrive the value. Althought i did have to chnage the syntax to

var = request->get_header_field( name = 'gd_id' ).

is this correct. Also do i need to create the variable gd_id anywhere, as you dont seem to be able to create any attributes within controller.

Regards

Mart