velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Cowgar ...@cowgar.com>
Subject Re: Velocity, Torque, BLOB's
Date Thu, 08 May 2003 12:32:54 GMT
On Thu, 8 May 2003 10:36:08 +0100, Denis <bredelet@mac.com> wrote:

>> How can I make Velocity display a BLOB (in java, bytes[]) as a string?
>
> Try:
> #set (string = "")
> $string.valueOf(bytes)

Hum,

That didn't quite work. I tried both $s.getDescription(), $s.Description 
but it created the same thing:

-- Output Screen (browser) --

Sections

    1: Hello [B@1687dcd
    2: Section 2 [B@11b456f
    3: Yes, another testing section [B@16b7e0e

----

Here's my code:

-- VM --
#set ($string = "")
<p>Sections<br />
<ul>
#foreach( $s in $sections )
  <li>$s.SectionId: $s.Name $string.valueOf($s.Description)</li>
#end
</ul>
</p>

#if ($error)
<p class="error">$error</p>
#end
----

-- JAVA --
try {
	Criteria crit = new Criteria();
	List v = SectionsPeer.doSelect(crit);
	context.put("sections", v);
} catch (Exception e) {
	context.put("error", e);
}
----

-- Revelant XML schema for Sections --
<table name="SECTIONS" idMethod="native">
    <column name="SECTION_ID" required="true" primaryKey="true"
      autoIncrement="true" type="INTEGER" />
    <column name="NAME" required="true" type="VARCHAR" size="60" />
    <column name="ICON" type="VARCHAR" size="30" />
    <column name="DESCRIPTION" type="BLOB" />
    <column name="STATUS" type="CHAR" size="1" />
</table>
----

-- BaseSections.java "revelant portions" --
private byte[] description;

/**
 * Get the Description
 *
 * @return byte[]
 */
public byte[] getDescription()
{
	return description;
}
----


Thanks for any help,

Jeremy


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message