Forum Stats

  • 3,873,471 Users
  • 2,266,576 Discussions
  • 7,911,548 Comments

Discussions

Read China content in JSP and store in Java variable

653189
653189 Member Posts: 101
edited Sep 13, 2008 1:50AM in WebLogic Portal
Hi All ,

I have created China language content(BinaryType) using weblogic admin console.
And I am trying to get the content and to store in a Java Variable .

Pls suggest me how to read other language content and to store in java variable for manipulation.

Srinivas



I am using following lines of code to get content



<utility:forEachInArray array="<%=newsID%>" id="node" type="com.bea.content.Node">

**************

INodeManager nodeManager = ContentManagerFactory.getNodeManager();
java.io.InputStream is = nodeManager.getStream(new ContentContext(), node.getId(),
"News-Content");


when I am using inputstream "is" to read the china content , its displaying garbage values.

Answers

  • 648793
    648793 Member Posts: 96
    edited Sep 10, 2008 10:24AM
    This is happening because of wrong encoding of your file. Make sure when you are saving the file change its encoding to UTF-8. Open your file in nodepad-->File->Save As. In the last dropdown box select encoding UTF-8. Otherwise your file saved in ANSI, which is default.

    Hope it helps

    Edited by: NowWLP102 on Sep 10, 2008 7:24 AM
  • 653189
    653189 Member Posts: 101
    Hi Rajeev,

    I am creating the content using Content Editor that's comes with weblogic portal administrative console.

    I am simply copy+pasting the China content given by client to the content editor.


    After that I am reading this content in JSP , and storing in a Java variable for some manipulation.
    during manipulation , its showing garbage values.

    Pls suggest this..

    If required I will provide the JSP code also.


    Srinivas
  • 648793
    648793 Member Posts: 96
    I would say you create your content in the nodepad and save it as utf-8. I am not sure what encoding is used when you save your content from WYSIWYG editor of WLP. Give it a try it, if it works then you can be sure its because of content encoding. If it works then we can think of some other option as to how to save it from WYSIWYG editor.
    648793
  • 653189
    653189 Member Posts: 101
    Hi Rajeev,

    Thanks for your reply , I tried in that way.
    But ,,,its not working in windows environment and working fine in Linux environment...Dont know why its behaving like this.I will work in linux env..for time being


    I have one more doubt.....that is....

    My content consists of (3 lines of text + one image ) as a single content.
    I am creating the content using portal content editor.

    I want to read the content and I want to modify 1st two lines of data and want to dislay in the browser.

    If the content is simple text , then I am able to preform this.
    But the content consists of image also...How to proceed like this.


    Pls suggest me this.

    Srinivas
  • 648793
    648793 Member Posts: 96
    Do you mean you have a content ABC with three properties, one of them being a binary which has image? or Do you mean your content only has one property which has a binary HTML or some other file and has a link to image inside it?

    Can you post your content property structure here?
  • 653189
    653189 Member Posts: 101
    Hi Rajeev,

    My Content consist of following properties

    News-Author String
    News-Content Binary
    News-Id String


    "News-Content" is Binary Type .I am creating data for this property using Content Editor.
    My data consists of 3 lines of text+image

    data will be:

    author is srinivas
    created on 11th
    content is newscontent
    << inserted image >>

    where << inserted image >> ,is jpeg file.

    I want to read this data in the JSP and store in java variable , so that i can modify 1st two lines and updated data to be displayed in browser..

    I am able to read data , if its a simple text . But it has one image also.


    How to solve this issue.

    Srinivas
  • 648793
    648793 Member Posts: 96
    Hi Srinivas

    I am again a little confuse. On one binary property either you can save and HTML/TEXT/PDF etc. But you are saying that you created a document (lets assume its HTML) and you inserted an image in it with WLP WYSIWYG editor. If you try to do that the editor lets you select an image either from WEB or from your content management repository. In either case editor just put the link to the image instead of image itself. So in my openion its just a text file nothing else. Can you download you binary file from repository on ur local drive and see what exactly inside it?
  • 653189
    653189 Member Posts: 101
    Hi Rajeev,


    Thanks for the reply...I will check the file as you suggested.
    I will reply once i tested like that...

    Once again thnx for your suggestions.

    Srinivas
This discussion has been closed.