Environment :
EP 6.0 SP4 [ With SQL Server ] running on Windows 2000
Requirement :
I have two JSPDynPage iView ...
1) Order Search : User can enter criteria and search
orders. It shows order search
results.
2) Order Information : User can see order
information.
I can create a page and add the two iViews and let the two iView communicate using client side Epcf.
So , after searching orders on the first iView, they can click on the order link to see the details on
the second iView. These is not a problem.
The requirement is to add just the first iView on a page so that when user selects an order from the order
search result, the user can see the content of second iView in place of the first iView. I do not want to
merge the two iViews as one since it will be duplicating the code. I want to maintain them as different iViews
so that there use can be maximized on different pages. I am having problem doing these as mentioned below.
Problem : I have added code to show the content of the second iView when user selects an order from the order search result as shown below ...
Order Search iView :
public void doProcessBeforeOutput() throws PageException
{
....
INode myNode = request.getNode();
IPortalComponentContext cntxt = request.getComponentContext("OrderInformation.default");
IComponentNode cnode = myNode.getPortalNode().createComponentNode("OrderInformation", cntxt);
((IPortalComponentResponse)this.getResponse()).include( request , cnode );
....
}
Because of the above code, the second iView is shown when the user selects the order. The content is not a problem any more. When I click on any of the button on the order information iView ( second iView ), I get error saying that there are no method with that name in the first iView and it is for every event associated with the second iView.
After searching sdn for information, I found out that I have to set Node so that the second iView can receive those events from the second iView instead of the first iView receiving the events as discussed in the link below ...
passing-control-from-one-component-to-another
I have never worked with setting the NodeMode before so I read the information provided in PRT guide. I updated the first iView's portalapp.xml file with the following to the first iView ...
...
<component-config>
...
<property name="mode" value="content"/>
<property name="delegate" value="OrderInformation.default"/>
</component-config>
...
and added the following to the first iView after the include as shown above ...
((IPortalComponentRequest)getRequest()).getNode().setNodeMode( new NodeMode("content") );
The reason I set "mode" property to "content" since "content" is a valid mode and when we set the NodeMode to that, the delegated iViews "doContent" method is called and then subsequent events are forwarded to the
delete gated iView which is Order Information ( second iView ) in my case. But the problem, the setNodeMode
is throwing the following exception ...
[PortalNode.fireEventOnNode.toEventListener] event=modeChangeEvent, target=OrderSearch.default, operation failed
java.lang.IllegalStateException: setNodeMode is not allowed during CONTENT or AFTER_CONTENT phase
at com.sapportals.portal.prt.pom.PortalNode.handleEvent(PortalNode.java:634)
at com.sapportals.portal.prt.pom.PortalNode.fireEventOnNode(PortalNode.java:355)
at com.sapportals.portal.prt.pom.ComponentNode.setNodeMode(ComponentNode.java:595)
...
Since the mode is not set, the second iView's events are forwarded to the first iView. Also, I noticed that the url for the first iView remains the same when the content changes for the second iView since the include function only adds content.
My thinking is that the PRT run time determines how to forward even calls by the url and since the url is that of the first iView event though the content is of the second iView, the events are forwared to the first iView.
Resolution Questions :
1) Does the Portal Runtime allow to set NodeMode for JSPDynPage ??
2) Is there any way I can call the following function in such a way that it does not through any error ??
( If I can set the NodeMode properly, probably the events will be forwarded properly !!)
((IPortalComponentRequest)getRequest()).getNode().setNodeMode( new NodeMode("content") );
3) Is there any other solution to the problem described above ??
I appreciate your help !!