on 01-03-2008 4:50 AM
hi ,
I hv an application where the attributes are accessed from a backend java file.
i hv created a new attribute :
#----
//create a label
IWDLabel hp= (IWDLabel)view.createElement(IWDLabel.class,"hpage");
hp.setText("HOME PAGE");
theGroup.addChild(hp);
//create an input field
IWDInputField homepage= (IWDInputField)view.createElement(IWDInputField.class,"hp");
IWDAttributeInfo attr=(IWDAttributeInfo)wdContext.getNodeInfo().getAttribute("HomePage");
homepage.bindValue(attr.getName());
theGroup.addChild(homepage);
-
#
and i hv bound it as:
#----
public void wdDoInit()
{
IWDNodeInfo node =wdContext.getNodeInfo().addChild(
"DynamicNode", null,true, true,false,false, false,true,null,null,null);
//Create backend connection to SomeBackEnd.java
SomeBackEnd theBackend = new SomeBackEnd()
// loop through all fields of the Object[] fields containing the
// FieldDescriptors
for (int index = 0; index < theBackend.getNumberFields(); index++) {
// ... and simply create the required context attribute
SomeBackEnd.FieldDescriptor fld = theBackend.getField(index);
node.addAttribute(fld.getName(), fld.getType());
}
wdContext.getNodeInfo().addAttribute("HomePage","com.sap.dictionary.string");*
wdContext.currentContextElement().setVisible(WDVisibility.NONE);
}
-
#
bt when i click on save btn iget the following output:
HOME PAGE:DataAttributeInfo(DynamicView.HomePage)
even if i leave it blank or enter some data.
i hv written the following code in save btn:
#----
Object obj=wdContext.getNodeInfo().getAttribute("HomePage");
if(obj==null)
obj="<NULL>";
result = "Your data was successfully saved:" + "\n\r";
result = result + "HOME PAGE" + " :" + obj.toString()+"\n";
#----
Hi,
try printing
wdComponentAPI.getMessageManager().reportSuccess(String.valueOf(wdContext().currentContextElement().getHomePage());
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ankita,
The purpose of using a backend java file is to make use of the concept of one change at one place. Like in your instance I believe that if you create a inputfield in the backend java file in the following manner
"new FieldDescriptor("InputField","homePage","com.sap.dictionary.string","Home Page","Enter your homepage url here",""),
it should suffice. There is no need to explicitly call the attribute as you are trying to do. Try this. With reference to your code I believe that the application will create the attributes and when you are printing your result it will display the value in your inputfield.
Regards,
Pinac
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
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.