On 12/09/11 20:23, Herli Joaquim de Menezes wrote:
Hi,
I have followed the Andy's hint to solve the problem of presenting the
ResultSet of a RDF query in a JSP page. So I used the ResultSetFormatter. In
order not to overload this message, I pasted the snippet at
http://pastebin.com/2XyhsCVe.
These lines are in the wrong order: line 48 and 48:
resultadoReusavel.reset();
ResultSetFormatter.out(System.out, resultadoReusavel, query);
because ResultSetFormatter.out will read the whol eresult set (twice, it
needs to do a pass first to calculate sizes of fields).
The problem comes from the fact that I have a list of keywords in order to
perform a query in a RDF document (it could be stored in a database..). As
the query is performed by a servlet, several resultsets are generated, one
per keyword.
So it works, but there is a trouble. When I try to pass these results to
JSP, using got only the last resultset. So how can I get all the rows
corresponding to the whole query? I don't know how to address just a row in
a result set, if I could, it would be possible to set a list of rows that
could be passed at the end of the whole query.
Any hint?
I don't completely underastand the problem statement. But you could
turn the result set into an array and then you can access rows buy index.
Generally with JSPs, I would put as little java code as possible into
the JSP, and make simple calls (statics) to java code to do the real
work. I find it makes testing and development a lot easier.
Putting as much processing of the results into a form that the
presentation stage can use easily - that can include creating
datastructures that make access to the data in the JSP simpler.
Andy