on 09-28-2007 12:05 PM
I try to complete the sample base on the Tutorial TutWD_Popup_Init. I deployed the application and it looks well. But as I click the button "To" I got exception as follow:
java.lang.NullPointerException
at com.sap.tc.webdynpro.tutorial.popup.EmailView.onActionShowAddressbookPopup(EmailView.java:197)
at com.sap.tc.webdynpro.tutorial.popup.wdp.InternalEmailView.wdInvokeEventHandler(InternalEmailView.java:197)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
... 26 more
The code at line EmailView.java:197 is as follow:
// Save WindowInstance in Context
wdContext.currentPopupElement().setWindowInstance(window);
By debug I find wdContext.currentPopupElement() = null.
Has someone the same problem?
Hi Thomas,
as your coding looks fine, you should check your context node "Popup" - maybe the mistake is in there. Especially check the collection cardinality (1..1), which seems like the most likely cause for the NullPointerException to me.
Regards,
Ulrich
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Add the element to the node as follows
IPrivate<viewname>.IPopupElement ele = wdContext.nodePopup().createPopupElement();
ele.setWindowInstance(window);
wdContext.nodePopup().addElement(ele);
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1.
the type of attribute "WindowInstance" is com.sap.tc.webdynpro.services.session.api.IWDWindow.
2.
Your link seems do not help.
Here is my code:
...
import com.sap.tc.webdynpro.services.session.api.IWDWindow;
...
IWDWindowInfo windowInfo =
(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
"AddressbookWindow");
// create the AddressbookWindow
IWDWindow window =
wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
// set the WindowPosition on the screen
window.setWindowPosition(300, 150);
// and show the window
window.open();
// Save WindowInstance in Context
wdContext.currentPopupElement().setWindowInstance(window);
If I use the downloaded ready_to_use code, it runs. I try< to find the differences but it seems impossible. There are too many files.
Message was edited by:
Thomas Roland
Hi Thomas,
What is the cardinality of the node PopupElement. I think its 0..1(n)
if its 0..1(n) then you need to create an element before accessing the current Element.
or else the simple option is to make the cardinality of the node PopUpElement as 1..1(n).
Other than that the code looks fine.
Regards
Ayyapparaj
Hi Thomas,
1.
You need to have an element of the node to set its attribute and if there is no element instantiated for the node and still you try to access its current<node>Element then you may turn up with nullpointer Exception.
Check the cardinality of the node. If its 0:1 or 0:n then you need to instantiate an object as I mentioned in the previous reply or the other alternative is you can change its cardinality to 1:1 or 1:n.
2.
Node is the popup node that you have defined in the context. If you want to add elements to your node programatically at runtime then the above mentioned code will do that for you.
Warm Regards,
Murtuza
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.