Consultor Eletrônico



Kbase 19189: Translating data from DB to generated HTML page
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/10/1999

SUMMARY: Translating data from DB to generated HTML page

Knowledge Base number: 19189
Creation Date: 8-Oct-1999
Author: Enrique Birlanga
This document applies to: Apptivity
Version and Release Number: V3.1 Build 223


INTRODUCTION:
This knowledge base intends to provide a solution to transfer data stored in a DB with a certain code page to the HTML page generated. This issue can be raised on those places where the native code page is special and the characters are not included on the standards code pages.

You may create your own translation classes. A possible solution to this problem will be creating a beanlet. The java code that this beanlet will perform will be getting the value from the DB and converted to the other code page. Once this is performed, the value can be displayed. An example of this will be:

public Object getDisplayValue( Object storageValue ){

if(storageValue == null){
return null;
}
else{
String x = (String)storageValue;
byte[] c = null;
try {
c = x.getBytes("8859_2");
x = new String(c);
}catch(java.io.UnsupportedEncodingException e) {}
return (x);
}
}

Note that if the fields where the data is displayed are updatable, you need to create the procedure to convert back the data modified into the code page of your DB. An example would be something like:

public Object getStorageValue(Object displayValue,boolean testing){

if(displayValue == null){
return null;
}
else{
String x = (String)displayValue;
byte[] c = null;
try {
c = x.getBytes();
x = new String(c,"8859_1");
}catch(java.io.UnsupportedEncodingException e) {}
return (x);
}
}


REFERENCES TO WRITTEN DOCUMENTATION:
Kbase: 18217.


EBI (8-OCT-1999)

Progress Software Technical Support Note # 19189