cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the view, which has to be shown at runtime?

Former Member
0 Kudos

Hi,

in my application i have more than one view, but at runtime only one of these views has to be shown. I want to decide this via a parameter that I get from the url.

How can i set the right view to be showing at runtime?

I tried it with a StartView which fires the right Outbound Plug in his wdDoInit-Method. This is working fine, but the problem is, that the method OnPlugDefault() of ComponentInterfaceViewController isn't called already at this time. So in the Init-Method of the StartView I don't have the given URL Parameter, so I can't decide which Plug I want to fire. The method OnPlugDefault() is called only after the init-method of the StartView.

Is there any other possibilty to set the view, which has to be shown, at runtime?

Thanks and Best Regards

Katharina

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

One way is you can pass the parameter in the URL , read the parameter and then fire the outbound plug depending upon that.

You can read the parameters as follows

HttpServletRequest request =Task.getCurrentTask()

.getWebContextAdapter()

.getHttpServletRequest();

String[] param1 = request.getParameterValues("<<PARAMETRNAME");

if(param1.equals("VALUE"))

fire outbound plug1;

Regards, Anilkumar

katharina_seiz
Employee
Employee
0 Kudos

Thanks,

that was the right hint.

But the coding

HttpServletRequest request =Task.getCurrentTask()

.getWebContextAdapter()

.getHttpServletRequest();

wasn't quite correct. The last method isn't available on ContextAdapter.

But I found this one:

String[] param = Task.getCurrentTask()

.getWebContextAdapter()

.getRequestParameterValues(<paramname>);

Thanks and Best Regards

Katharina

Former Member
0 Kudos

Don't do it this way!

"Task" is not part of the API, use


WDWebContextAdapter.getWebContextAdapter().getRequestParameter(key)

Armin

Answers (2)

Answers (2)

former_member146451
Participant
0 Kudos

Hello all. Anyone can tell me how can i modify the /irj/portalapps/com.sap.portal.pagebuilder/scripts/pagesupport.js file ? Thanks.

Former Member
0 Kudos

Try the following:

1. In Component Controller create event SelectView with single argument <i>String viewName</i>

2. In Component Controller context create attribute ViewName

3. In wdDoBeforeNavigation of Component Controller fire event SelectView with viewName argument from context attribute. Also you may add check here to invoke this event only ones for component lifecycle.

4. Add Component Controller to "Required Controllers" on "Properties" tab of Interface View Controller.

5. In plug handler of Interface View Controller set ViewName attribute in used Component Controller context.

6. Add Component Controller to "Required Controllers" on "Properties" tab of dispatching View Controller and subscribe to SelectView event

7. Fire necessary plug in SelectView event handler depending on viewName argument

VS