on 07-27-2005 6:23 AM
Hi, i'm new to WebDynpro. I want to know the steps to get the contents of a web page dynamically which is stored in a flat file.Please help in this asap.
No more field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil,
If you specify the path like that.. I think it wont understand and you get such exception
Check the below code..
String strPath = WDURLGenerator.getResourcePath(
wdComponentAPI.getDeployableObjectPart(),
"xxx");
FileReader fileReader = new FileReader(strPath);
where "xxx" is your file name.
Try to use the about code to get the path of your local file.
Regards,
Kavitha
hi,
if you are deploying your application in some other machine, then the flat file which your application is referring should also be in that machine , otherwise it'll throw filenotfound exception. so you try to put your flat file in the server and then run the application
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Are you getting any exception while reading that file or it showing blank results ?
Please post the exceptions if any.
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, This is my code wriiten in buttonAction.
i'm getting the following Exception. And file is there in the specified location also.
java.io.FileNotFoundException: D:\Test\file.txt (The system cannot find the path specified)
public void onActionBtnShow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionBtnShow(ServerEvent)
try{
FileReader f =new FileReader("D:
Test
file.txt");
BufferedReader r=new BufferedReader(f);
String names=r.readLine();
wdContext.nodeTestNode().currentTestNodeElement().setCtxTextEdit(names);
}
catch( Exception e ) {
String Ex = e.toString();
wdContext.currentContextElement().setValue(Ex);
}
//@@end
}
Help me in this..i'm stuck for last three days in this.
thanks and regards,SenthilNathan.
Hi,
Are you deploying on your localmachine only ??
Please remove the blank spaces in the directory name if any.
Make sure that this directory exitis where the engine is ?
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In that case directly you can pass the location of the file for the filereader.
Regards, Anilkumar
Message was edited by: Anilkumar Vippagunta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
FileReader f =new FileReader("D:
New Folder
file.txt");
i'm getting the exception java.io.FileNotFoundException: D:\New Folder\file.txt (The system cannot find the path specified)
But it is working in core java execution..
what is syntax to give filestructure for fileReader();
please help in this.
Hi,
First i suggest to check the vector weather it conatins the list of names or not.I feel something wrong with the way you are reading the values from the file.
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil
1. Create a node in the context say Flatfile with cardinality 0..n
2. Create a value attribute Eachline of type string in the node.
3. Create a Http alias for a directory where you have place a flatfile
try {
BufferedReader in = new BufferedReader(new FileReader(<http alias name>/<filename>));
String str;
i=0;
while ((str = in.readLine()) != null) {
IPrivate<viewname>.INodeFlatFile nodeflatfile = null
INodeFlatFile = wdContext.nodeFlatFile.createNodeFlatFileElement();
wdContext.nodeFlatFile.addElement(i,nodeflatfile);
i++
nodeflatfile.setEachline(str);
}
in.close();
} catch (IOException e) {
}
Let me know if you require additional help.
Regards
NagaKishore
Hi,
1.First you need to read the file and populate the context in webdynpro.
2. Iterate through the context and create&Bind the UIElements in the wdDoModifyView method.
Refer to DynamicProgramming tutorials for this.
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil,
You can do this by normal java file reading !!!
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I would advise you to go through this.
http://help.sap.com/saphelp_nw04/helpdata/en/89/73a840bd6d3c13e10000000a155106/frameset.htm
You have to get the no of UI elements needed,
use a loop and create as many elements as needed using
view.createElement(UI class,ID);
Hi Senthil,
If you requirement is read a flat file on click of the LinktoURL,
1. Create a Http System alias in Visual admin.
Refer to this blog for details.
/people/renjith.andrews/blog/2005/03/31/creating-an-http-alias-in-was
2. Store all your flat files in the direcory specified in the alias.
3. Link the Http alias with the filename to the reference property of linktoURL UI element.
OR
If you want to create dynamic UI elements based on the content of the flat file then onload of the view you can read the file from the Http alias you have created and do the necessary creation.
Regards
NagaKishore
HI All,
Can anone help me by sending the fullcode to extract contents from file to the UI elements like LinktoURL,
the page may have more UI elements,textviews etc..
i tried the following code..but it is not working.
i'm new to this but i need it very urgently..please help me in this..and i tried this in doInit().
try{
FileReader f =new FileReader("file.txt");
BufferedReader r=new BufferedReader(f);
String names=r.readLine();
Vector Names=new Vector();
//Use Tokenizer and store all the names i a vector//
for(int i=0;i< Names.size();i++){
IPrivateLinkView.IContextElement l1 =wdContext.createContextElement();
l1.setCtxLink( Names.get(i).toString());
wdThis.wdGetContext().addElement(l1);
}
}
catch( Exception e ) {
e.printStackTrace();
}
Thanks and regards,
SenthilNathan.
Hi Senthil,
FileReader f =new FileReader(path);
Give the full path name in place of path.
It is better to use
IPrivateLinkView.I<node name>Element l1
for(int i=0;i< Names.size();i++)
{
l1 = wdContext.create<node name>Element();
l1.setCtxLink((String) Names.get(i));
wdThis.wdGetContext().addElement(l1);
}
If your problem is not solved give the code where you use String tokeniser to seperate values
Regards,
Rohit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.