on 03-27-2008 9:58 PM
Hi, Im following this blog https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5892. [original link is broken]
I sucessfully implemented first part to my project there is a problem with second part, from comments I see that not only I do.
the code is:
try{
Connection con=new SAPDBConnection().getConnection();
Statement st=con.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM SDN_USERS");
while(rs.next())
{
String name=rs.getString( 1);
byte[] b=rs.getBytes(2);
IWDResource res=WDResourceFactory.createCachedResource(b,"MyImage",WDWebResourceType.JPG_IMAGE);
IPrivateGeneratorView .IImageTableElement imageEle=wdContext.createImageTableElement();
imageEle .setName( name);
imageEle.setImage( res.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
wdContext.nodeImageTable() .addElement(imageEle );
}
}
catch(Exception e){
wdComponentAPI.getMessageManager().reportWarning(e.toString());
}
and I get:
The method setImage(IWDResource) in the type IPrivateMyProjectView.IImageTableElement is not applicable for the arguments (String).
Is there any solution to this? Regards, Balmer
Hi,
Try modifying your code to this:
imageEle.setImage(res);
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is the error that you get now?
In your original code, the Image context attribute was of type IWDResource but you were setting it to the URL string of the resource, hence it was throwing an error. If you want to use the original code, make the Image attribute as String type and bind it to the "source" property of the Image UI element within the table.
Regards,
Satyajit.
I get "res is not byte[]" type. It goes fine (It looks like at least) when I do
imageEle.setImage(b); //Image is type of binary
No error are listed but Im not able to dispaly it as a picture in an Image child of type String.
How do I conver binary,byte to a String type?
For a "Resource" type context I use
if (element.getFileResource() != null) {
element.setImage(element.getFileResource().getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
}
and it works fine but I dont know how to do it in my case. Please advice, Balmer.
Edited by: Balmer on Mar 29, 2008 4:23 PM
Still no resolution, any advice will be most welcome. It's very urgent. Thanks in advance. Balmer
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.