on 01-14-2009 4:04 PM
Hello,
I am new to the world of web dynpro java - and have a question concerning an easy web dynpro application:
I created a model based on a WSDL file and conducted the mapping (model --> component controller context --> view context).
Now i want to bind a context element of the model to an input field of a view, but after doing that and deploying the application the input field is disabled - though the input field readonly and enabled properties are set to 'false' respectively 'true'.
Are there any suggestions for a solution?
I also wasn't able to change the element value of the bound model attribute by coding - is that possible at all?
Thanks in advance,
Falk
Hi,
finally... i found the answer - and it was quiet simple: i forgot to import the package/class 'GetWeatherByZipCode':
import mymodel.MyModel;
import mymodel.Request_GetWeatherByZipCode;
import mymodel.GetWeatherByZipCode;
import mymodel.myweatherapp.comp.wdp.IPrivateMyWeatherComp;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
After that the code suggested in thread
worked fine:
MyModel model = new MyModel();
Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);
zip.setGetWeatherByZipCode(new GetWeatherByZipCode(model));
wdContext.nodeRequest_GetWeatherByZipCode().addElement(wdContext.createRequest_GetWeatherByZipCodeElement(zip));
Thanks @all for your help!
Falk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Siva,
I tried your coding - without any error, but unfortunately the input field is still disabled. I also can't imagine that I've done the mapping wrong...
Are there any other ideas (i'm running out of them...)?
Falk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wolfram,
could you please help me out...i'm trying to devlop CE 7.1 application with model, some how not able to get it right. I'm getting null pointer excepiton.
java.lang.NullPointerException
at com.sap.mdi.ddtypes.DDDataelement.getFieldtexts(DDDataelement.java:219)
at com.sap.dictionary.types.mdi.util.TextServices.getFieldLabel(TextServices.java:67)
thanks
Anup
Hi Falk,
I have given some sample code to create model instance and bind it to context. But you need to do it for your all input context nodes.
//creating an instance of the model class
xxxx var_name = new xxxx(model);
// binding the object to the Content
wdContext.node<name>().bind(var_name);
Particularly you need to do it for the node which consists the attribute that bound to input field.
And carefully check the context mapping as well as the context binding.
Regards,
Siva
hi,
i inserted the coding, and now i receive an error message (i.e. the disabled label respectively the browser screen isn't shown at all):
com.sap.tc.webdynpro.progmodel.context.ContextException: NodeElement(.MyWeatherComp.Request_GetWeatherByZipCode): model node element cannot be created without a model instance
i'm quite new to the java programming language, but asking myself if we didn't create the model instance in the coding above.
what could still be wrong?
regards,
falk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
thanks a lot for the link. I had a closer look a the following thread
and tried to rebuild the given example.
My wdoInit mehtod of the component controller looks like this - the input field is still disabled:
//creating an instance of the Model
MyModel model = new MyModel();
//creating an instance of the model class
Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);
// adding an instance of the model element to the object
wdContext.nodeRequest_GetWeatherByZipCode().addElement(wdContext.createRequest_GetWeatherByZipCodeElement(zip));
// binding the object to the Content
wdContext.nodeRequest_GetWeatherByZipCode().bind(zip);
Unfortunatley I wasn't able to run the following method for setting an attribute to the object like suggested
zip.setGetWeatherByZipCode(new GetWeatherByZipCode(model));
--> if I'm trying to implement this, an error is shown (GetWeatherByZipCode cannot be resolved to a type).
Has anybody an idea why this is error occurs or can anyone give a hint concerning coding mistakes?
Thanks in advance,
Falk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Changed your code a bit, try this:
//creating an instance of the Model
MyModel model = new MyModel();
//creating an instance of the model class
Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);
// adding an instance of the model element to the object
IRequest_GetWeatherByZipCodeElement ele = wdContext
.nodeRequest_GetWeatherByZipCode()
.createAndAddRequest_GetWeatherByZipCodeElement();
// binding the object to the Content
wdContext.nodeRequest_GetWeatherByZipCode().bind(ele);
For the type not resolved problem, press "CTRLShiftO" to organize your imports.
Regards,
Satyajit
Hello Falk,
Can you try this code please?
MyModel model = new MyModel();
//creating an instance of the model class
Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);
// binding the object to the Content
wdContext.nodeRequest_GetWeatherByZipCode().bind(zip);
If you get any errors then organize imports using CtrlShiftO and rebuild the project.
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.