on 07-18-2006 9:50 AM
Hi all
Can I associate a context variable in Webdynpro-java to an Input field in my program.ie.I will create only the UIElements at design time but define the context variable and their association to UI elements will be done in program at runtime.Also can I store these context variables created(if possible) to arraylist.How can I pass that arraylist to the next view?
If anybody knows, please help me.
Thanks in advance
Fahad Hamsa
Hi
Whenever you use wdContext.current<Node>Element().set<Attribute>() or wdContext.current<Node>Element().get<Attribute>() you have to be sure that the element exists.If it doesn't exist, you will get null pointer exeption because you are trying to access an element which doesn't exist.
To be able to use above methods, you can set the cardinalities of the node to either 1..1(Exactly one element) or 1..n(At least one element).This ensures that at least one elemnt is created.
If you have to use 0..1(At most 1 element) or 0..n(Any no. of elements), you will have to first create the element using wdContext.create<Node>Elemet() before using
wdContext.current<Node>Element().set<Attribute>() or wdContext.current<Node>Element().get<Attribute>().
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
In the detailed description check on which line of your program you are getting this error.
BTW, this might be occurring because you are trying to access some method of HashMap directly e.g
HashMap hm = wdContext.currentContextElement().getHashMap();
hm.put("name","value");
You will have to instantiate the HashMap before accessing it.
e.g.
HashMap hm = new HashMap();
hm.put("name","value");
after performing the operations on HashMap you can set it to the context variable as
wdContext.currentContextElement().setHashMap(hm);
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you can. As this affords having references to the UI elements, it can only be done inside method wdDoModifyView().
I don't understand your question about the ArrayList etc.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fahad,
You can use the Hashmap to store the context attributes using key and value. And in the next view you can retrieve the values using the KEy in Haspmap
Hope this helps,
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please tell me how can I associate a context variable that is not declared with an input field in table.Also after this association with context variables,if I m putting the values in a context variable of HashMap type,can I avoid the server hitting of table elements when the row of table changes?
What I am trying to do is creating a table and associating
the table cell editors with context variables in the program(without declaring in context tab).After that, when user enters some values in this table, I want to store all values in a hashmap in a local HashMap variable and atlast assign this to the hashmap variable that is declared in the context tab, so that I can pass these values to the next view.I am trying to do this because I thinks it willnot goto server every time when the user changes the row in table.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.