6

We are facing issue in getting RTF text if we use any HTML tag in RTF(Simple text working fine in all conditions).

case 1. when i use simple one level text field as RTF in schema and use below code:enter image description here

public String getzeroLevelRTF(GenericComponent comp) {
    String zerolevelrtf = "";
    if (comp != null && comp.getContent().containsKey(Constants.ZERO_LEVEL_RTF)) {
        if (comp.getContent().get(Constants.ZERO_LEVEL_RTF) instanceof XhtmlField) {
            XhtmlField xhtmlField = (XhtmlField) comp.getContent().get(Constants.ZERO_LEVEL_RTF);
            zerolevelrtf = getValueFromXhtmlField(xhtmlField);
        }
    }
    return zerolevelrtf;
}

Its working as expected on Tomcat but when it is deployed on Webshpere it returns empty string(only when i use any html tags in component otherwise for plain text its working fine on Webshpere also)

case 2.when i use RTF as component link in schema and use below code: enter image description here

public String getcompLevelRTF(GenericComponent comp) {
    String complevelrtf = "";
    if (comp != null && comp.getContent().containsKey(Constants.COMP_LEVEL_RTF)) {
        if (comp.getContent().get(Constants.COMP_LEVEL_RTF) != null
                && comp.getContent().get(Constants.COMP_LEVEL_RTF) instanceof ComponentLinkField) {
            ComponentLinkField compLinked = (ComponentLinkField) comp.getContent().get(Constants.COMP_LEVEL_RTF);
            for (Object obj : compLinked.getValues()) {
                if (obj != null && obj instanceof GenericComponent) {
                    GenericComponent rtfComp = (GenericComponent) obj;
                    if (rtfComp.getContent().containsKey(Constants.RTF_DISCLAIMER)) {
                        XhtmlField xhtmlField = (XhtmlField) rtfComp.getContent().get(Constants.RTF_DISCLAIMER);
                        complevelrtf = getValueFromXhtmlField(xhtmlField);
                    }
                }
            }
        }
    }
    return complevelrtf;
}

Its working as expected on Tomcat as well as on Webshpere.

Don't understand what i'm doing wrong in case 1.

4
  • What version of DD4T are you using? What version of Java is running of Websphere and what version of Websphere itself? Feb 3, 2016 at 12:00
  • we are using DD4T 1.31, Java version running on Websphere 1.7 64 bit and Websphere version 8.5. Feb 3, 2016 at 12:41
  • It returns 'null', but you initialize it with an empty string. The only place where this can happen (AFAICS) is in getValueFromXhtmlField. Maybe you can start debugging this method with the EXACT same HTML as in the working (complink) example? My guess would be that this getValueFromXhtmlField plays a role in this mystery :) Feb 4, 2016 at 6:48
  • It was returning "empty string" not "NULL". i think i made question little bit fuzzy up there. Let me make it more clear, On tomcat server its working fine(for every case) BUT when i run same function, same code, same HTML, using same CMS and same Broker DB on websphere server it returns empty string BUT again case two i.e when i use RTF in Component link it works fine for same HTML on websphere also. Not able figure it out what we are missing there.(And also plain text works in all case for tomcat as well as for webphere) Feb 5, 2016 at 14:53

2 Answers 2

4

make following changes in the file "dd4t-core/src/main/java/org/dd4t/core/util/XSLTransformer.java "

enter image description here

comment selected lines and restart server.

3
  • 1
    Can you explain the solution? Feb 8, 2016 at 14:15
  • Thanks solutuion provided above worked perfectly...Naresh can you please expalin the solution ? Feb 8, 2016 at 16:03
  • 1
    WAS provides Web Container custom properties configured at Admin configurations which are specific for parsing the html responses. WAS doesn't require xlan transformation to parse hmtl. Feb 9, 2016 at 5:19
-2

Often this kind of a bogus issue occurs when the local config points to one broker DB instance while the integration server points to another DB. Another reason: local config is set to read from Staging while the integration config is set to read Live. So make sure you are pointing to the same DB on your Tomcat and Websphere instances.

3
  • -1 for putting it as asnwere. It mentioned that its working for tomcat and not for websphere. It working for plain text in all cases and working for RTF too when RTF is linked as component. Feb 3, 2016 at 13:07
  • we are using correct DB instances as it is working as expected when i run same application on Tomcat. But when i run same application on websphere we get this issue. Also for plain text it is working as expected on both tomcat and websphere. Feb 3, 2016 at 13:19
  • 1
    Ok then. Good luck to you Feb 4, 2016 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.