Re: long sql string data displayed incorrectly from sql

2004-10-20 Thread Kris Schneider
Which means your data is being returned as a byte[] and you'll need to do some
post-processing to turn that into a string. Which version of JSTL are you
using? Lots of ways you could do that, of course. One would be to create a
simple helper bean (untested):

package com.dotech;

import java.io.Serializable;

public class BytesAsStringBean implements Serializable {

private String charsetName;
private String s;

// set this before using setBytes if you want a non-default charset
private String setCharsetName(String charsetName) {
this.charsetName = charsetName;
}

pulic void setBytes(byte[] bytes) {
this.s = ((this.charsetName == null) ? new String(bytes) : new
String(bytes, this.charsetName);
}

// could also override hashCode and equals

public void toString() {
return this.s;
}
}

Then use it in a JSP (untested):

jsp:useBean id=bytesAsString class=com.dotech.BytesAsStringBean/
c:set target=${bytesAsString} property=bytes value=${row.commentBody}/
c:out value=${bytesAsString}/

Quoting helmutburri [EMAIL PROTECTED]:

 Hi I have a mysql database that I is storing the data correctly however 
 if that data is of type blob or text or mediumblob or any other large 
 string object and I try to display that long string I get something 
 like this:  [EMAIL PROTECTED] or this [EMAIL PROTECTED] back on the c:out
 
 this is the code I am using?
 
   sql:query var=commentQuery
  SELECT * FROM soapBoxComments WHERE weblogID = 'c:out 
 value=${param.id}/'
  /sql:query
 
  c:forEach items=${commentQuery.rows} var=row
  br /c:out value=${row.commentUserName} /
  br /c:out value=${row.commentUserEmail} /
  br /c:out value=${row.commentBody} /
  div class=boxFooter bgLimeGreen uppercase white 
 alignRightnbsp;/div
  /c:forEach
 
 Now the c:out value=${row.commentBody} / is the data type blob.
 
 Any suggestions. All other data-types are fine.
 
 Kurt

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



long sql string data displayed incorrectly from sql

2004-10-16 Thread helmutburri
Hi I have a mysql database that I is storing the data correctly however 
if that data is of type blob or text or mediumblob or any other large 
string object and I try to display that long string I get something 
like this:  [EMAIL PROTECTED] or this [EMAIL PROTECTED] back on the c:out

this is the code I am using?
	sql:query var=commentQuery
SELECT * FROM soapBoxComments WHERE weblogID = 'c:out 
value=${param.id}/'
/sql:query

c:forEach items=${commentQuery.rows} var=row
br /c:out value=${row.commentUserName} /
br /c:out value=${row.commentUserEmail} /
br /c:out value=${row.commentBody} /
div class=boxFooter bgLimeGreen uppercase white 
alignRightnbsp;/div
/c:forEach

Now the c:out value=${row.commentBody} / is the data type blob.
Any suggestions. All other data-types are fine.
Kurt
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]