Search code examples
struts2

How to use struts tags to output byte[] as String


i am using hibernate to save large amount of text as BLOB in the DB. Thus I have a class instance as byte[].

public class News {
  ...
  private byte[] content;

  // getter and setter
  ...
}

I am trying to output such variable as String in JSP, e.g. using <s:property> tag. Can anyone give a hint?


Solution

  • Struts2 uses OGNL http://commons.apache.org/ognl/. So in JSP do it like you would do it in Java.

    <s:property value="new java.lang.String(news.content)"/>