on 05-15-2008 3:21 PM
Hi!
I'm a rookie and therefore I'm practicing on compleating some tutorials like "Creating a Web Dynpro Tree" (https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0ec6622-8da5-2a10-349b-868b6a553efa)
I did just as the tutorial told me to (I think) but still I get a java.lang.NullPointerException when I deploy and run my application.
In the bold line is where it is something wrong:
public static void wdDoModifyView(IPrivateTreeView wdThis, IPrivateTreeView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if (firstTime) {
IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType");
/* parameter mapping from parameter "path" to
parameter "selectedElement"
*/
treeNode._mappingOfOnAction()._addSourceMapping("path", "selectedElement");
/* parameter mapping from parameter "path" to
parameter "element".
*/
treeNode._mappingOfOnLoadChildren()._addSourceMapping("path","element");
}
//@@end
}
What I don't understand is what the function/meaning of the parameter path is. The parameters selectedElement and element I do recognize and have written. And I don't understand why there is a difference between the two underscored line of code (see above) even though the comments claim that it does the same kind of mapping.
Best regards
/Johan
I never saw a method named "_addSourceMapping()".
Verify that the TreeNodeType instance has exactly the same ID (case-sensitive) than given in the string literal. The "path" parameter will give you the context path describing the tree node. Alternatively you can use the (implicit) parameter named "nodeElement".
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried to get "addSourceMapping()." underscored so people would better understand what I was referring to but it didn't work and that's why it looked weired.
Thanks for your help Armin, now it works fine.
It was as you said.
if (firstTime) {
IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType");
When I changed "TreeNodeType" to it's real ID, "TheNode" I didn't get a nullPointerException. I think it must be wrong in the tutorial because I followed the instructions which said to name it "TheNode" but then the author mus have forgot to change it from the default ID ("TreeNodeType").
Best Regards!
/Johan
[clarification to message above]
if (firstTime) {
IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType");
/* parameter mapping from parameter "path" to
parameter "selectedElement"
*/
treeNode.mappingOfOnAction().addSourceMapping("path", "selectedElement");
/* parameter mapping from parameter "path" to
parameter "element".
*/
treeNode.mappingOfOnLoadChildren().addSourceMapping("path","element");
}
The bold pieces of code is, according to the comments, supposed to do the same kind of mapping even though there is a difference between them other than the parameter names.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.