cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

MVC design pattern for developing BSP Applications

Former Member
0 Likes
836

Hello all,

I have just started my exploration in the MVC design pattern of BSP applications.(Beginner)

First let me tell, what my need is : When I run an application, an initial page should be shown with an input field and a button. On clicking the button the <u>value typed in the input field of the first page must be displayed in a new page</u>.

I am trying to do this with MVC design pattern. I know how to do the same if both were to be diplayed on the same page ( A single page with two views ). But I don't know how to do it, <u>if the second view is to be shown on a new page.</u>

Could any of you give me a hint on this.

Thanks and regards.

Loveline.

View Entire Topic
Former Member
0 Likes

Hi Max,

Thanks for the hint. I used the attribute action of the htmlb form. I was able to satisfy my need. I have included the code.

Lay out of first view

<%@page language="abap" %>

<%@extension name="htmlb" prefix="htmlb" %>

<%@extension name="bsp" prefix="bsp" %>

<htmlb:content>

<htmlb:page title="First Page " >

<htmlb:form action = "Second.do">

<htmlb:gridLayout columnSize = "2"

rowSize = "1"

cellSpacing = "10"

cellPadding = "10"

style = "TRANSPARENT" >

<htmlb:gridLayoutCell columnIndex = "1"

rowIndex = "1" >

<htmlb:inputField id = "IF1"

size = "10" />

</htmlb:gridLayoutCell>

<htmlb:gridLayoutCell columnIndex = "2"

rowIndex = "1" >

<htmlb:button id = "B1"

text = "Click Me"

onClick = "click" />

</htmlb:gridLayoutCell>

</htmlb:gridLayout>

</htmlb:form>

</htmlb:page>

</htmlb:content>

controller 1

DO_REQUEST Method

METHOD do_request .

DATA : view TYPE REF TO if_bsp_page.

DATA : value(10) TYPE c.

dispatch_input( ).

IF is_navigation_requested( ) IS NOT INITIAL.

RETURN.

ENDIF.

view = create_view( view_name = 'First.htm' ).

call_view( view ).

ENDMETHOD.

Lay out of second view with page attribute value

<%@page language="abap" %>

<%@extension name="htmlb" prefix="htmlb" %>

<htmlb:content>

<htmlb:page title="Second Page " >

<htmlb:form>

<htmlb:textView text = "This is the text entered in the initial page <b><%= value. %></b>"

tooltip = "Simple quick info"

encode = "true" />

</htmlb:form>

</htmlb:page>

</htmlb:content>

Controller 2 with attribute value

DO_REQUEST

METHOD do_request .

data : view type ref to if_bsp_page.

value = request->get_form_field( name = 'if1' ).

view = create_view( view_name = 'Second.htm' ).

view->set_attribute( name = 'value' value = value ).

call_view( view ).

ENDMETHOD.

Thanks once again.

Best Regards,

Loveline.

Former Member
0 Likes

Be sure to mark your problem as solved so others can benefit in the future and thanks for the code sample!!!!

Former Member
0 Likes

Hello Craig,

I had selected the option soloved. But I don't know why the status hasn't changed to solved ( blue star ). Is there any other way in setting the status of the topic posted ?

Thanks and regards,

Loveline.

maximilian_schaufler
Active Contributor
0 Likes

Hi Thomas,

if you yourself watch the topic, you will see a yellow star in the header lines of each single post made by others.

Just look for the post that you want to reward with some points, and then click on the according yellow star - there you can choose how many points this post should be awarded (10 for solved problem, 6 for very helpful, and 2 for helpful answer).

I guess the status star for the topic in the forum view will take the highest awarded points color (so far I only have seen grey or blue stars).

Edit: Have a look at these two blogs, they make for some nice reading and contain useful information!

<a href="/people/mark.finnern/blog/2004/08/10/spread-the-love">Spread the Love!</a>

<a href="/people/sap.user72/blog/2005/08/16/have-you-checked-your-stars-lately">Have you checked your stars lately?</a>

Take care,

Max

Message was edited by: Maximilian Moder

Former Member
0 Likes

You'll need to do as Max said, sometimes just marking it as solved when replying doesn't cover it.

Former Member
0 Likes

Yes, I have did it just as Max said.

Thanks to both of you

Best Regards,

Lovelne.