cancel
Showing results for 
Search instead for 
Did you mean: 

MVC-Layout not called

Former Member
0 Kudos

Hello,

in Do_Init of the main controller I´m creating the subcontrollers

sub_edit ?= create_controller( controller_name = 'edit.do'
                                 controller_id   = 'editctrl' ).
  subc_user ?= create_controller( controller_name = 'overview/user.do'
                                  controller_id   = 'userctrl' ).

in Do_Request of Edit.do I call the layout Edit.htm and in this one I call the subcontroller userctrl

<%-- Code Personal Nr. --%>
      <bsp:call comp_id = "userctrl"></bsp:call>

the damned layout never shows up in the application and I don´t know why. This other option does not work:

<bsp:call comp_id = "editctrl_userctrl" />

Can somebody tell me what the problem is ??

Thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You said:

in Do_Request of Edit.do I call the layout Edit.htm and in this one I call the subcontroller userctrl.

userctrl should then be a subcontroller of edit.do instead of your main controller.

Regards,

Tanguy

Former Member
0 Kudos

Hello guys,

Ramu:

your method doesn´t work, because the controller cannot be found

Tanguy:

your idea is not bad but it didn´t work with me and now I face the problem that I don´t see the content of layout User.htm in Main.htm

The subcontroller is called from 2 places (for avoiding repetion of code): Main.htm and Edit.htm and both like this:

<bsp:call comp_id = "userctrl" />

that´s why I created the subcontroller in Main.do

Former Member
0 Kudos

Hi,

Does it have to be the same controller instance for both main and edit controllers? I think you should create two controller instances, one for main and another for edit.

If you need the same instance, you can create it in main.do, then register it as a subcontroller of edit.do with if_bsp_dispatcher~register method. Still, this sounds weird to me since you will call twice the same controller within the same htmlb:form tag, which can create field ID conflicts. You will have to be careful if you use this.

Code example, in main controller:

edit_ctrl ?= create_controller( controller_name = 'edit.do' controller_id = 'edit' ).
user_ctrl ?= create_controller( controller_name = 'user.do' controller_id = 'user' ).
edit_ctrl->if_bsp_dispatcher~register( comp_id = 'edit_user' comp_instance = user_ctrl ).

In main.htm:

<bsp:call comp_id = "edit"></bsp:call>
<bsp:call comp_id = "user"></bsp:call>

In edit.htm:

<bsp:call comp_id = "user"></bsp:call>

Hope it helps,

Tanguy

Former Member
0 Kudos

Hi,

wonderful !! this time it works.

I just specify that I call the controller 'user.do' like this

In edit.htm:

<bsp:call comp_id = "edit_user"></bsp:call>

Thanks a lot

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I think you have to specify the URL attribute of bsp:call tag:

<bsp:call comp_id = "userctrl" url = "overview/user.do" />

Regards,

Tanguy

Former Member
0 Kudos

Hello,

I´ve tried that option before and doesn´t work. If we specify the URL, that means that we´re calling the controller for the first time and therefore it is created. In Do_Init I collect the model class from father object and with the URL, there´s no father and therefore a get a short dump.

I call the same controller from Main.htm just the same way and it works !!

Thanks anyway.

Former Member
0 Kudos

Friend,

Please try b giving the following statement in you Do_init...

means.. instead of using 'overview/user.do' in the method...use only 'user.do'.....

subc_user ?= create_controller( controller_name = 'user.do'

controller_id = 'userctrl' ).