Shawn Bayern wrote:
Once again, I'll strongly recommend that you use JSTL to access the Result
object; it wasn't designed for easy access in Java.  What are you
expecting to get from scriptlets in this case?
The goal is convert a recordSet in a String. Flash MX load the jsp output and convert in a Flash MX recordSet.

I must use jsp because I can control "\n" output. Now the output is more compress ^_^

I have understand some things about JAVA world thanks to all.
This is my last script with JSTL and JSP integration.


<%@ page import="javax.servlet.jsp.jstl.sql.Result" %>
<%@ taglib uri="/WEB-INF/tld/sql.tld" prefix="sql" %>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ include file="/global/connection.jsp" %>
<!-- After I use ? and getParam ^_^ -->
<c:set var="language_set" value="it" />
<sql:query var="elenco" >
SELECT ID_news,data,
titolo_<c:out value="${language_set}" /> as titolo,
abstract_<c:out value="${language_set}" /> as abstract,
testo_<c:out value="${language_set}" /> as testo,
data
FROM tb_news
</sql:query>

<%
// elenco is a JSTL recordSet
// RecordSet Compresion for Flash MX
// costanti per i terminatori

String tRow = "##";
String tColum = "#";
String initData = "####";

Result rs = (Result)pageContext.findAttribute("elenco");
int max = rs.getRowCount();
String[] columnNames = rs.getColumnNames();
// Start print Column
String rsString = "response=";


for (int c = 0; c < columnNames.length;c++){
rsString += columnNames[c] + tColum;
}
// Column end
rsString += initData;
// Start print recordSet Data
for (int row = 0; row < max; row++ ){
for (int column = 0; column < columnNames.length; column++){
rsString += rs.getRows()[row].get(columnNames[column])+ tColum; //--> Error: "No field name"
}
rsString += tRow;
}
rsString += "&";
out.print(rsString);
%>


Best Regards Lorenzo Sicilia

--
"Il fatto che un'opinione sia condivisa ampiamente non prova che non sia completamente assurda"
Bertrand Russell


--
To unsubscribe, e-mail: <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>



Reply via email to