Hi,
after a quick lookup, there doesn't seem to be any mistake with your
code. Either it's a problem with the jsp, either it's related to
database. Anyway, you might want to change this
// end try
catch(Exception ex) {
return false;
}
Generic catching of exception without reporting them somewhere is
generally bad design :)
password password wrote:
Hi,
I have a jsp where I show a table. I am trying to download this jsp
like excel file. To do this I put I get the information from a servlet and send this information in an attribute to the jsp
It works fine if I use only one browser.
The problem is when I try to do this but from 2 browsers at the same
time. From each browser I can download a part of the file but not the
complete file.
It seems the browsers are sharing the bandwidth and when it starts to
download a file the other stops.
Can you help me please?
The code of the servlet and jsp is the next:
///////////////////////////////////////////////////////////////////////////­­/////////////////////////////////////////
the SERVLET has the next code:
///////////////////////////////////////////////////////////////////////////­­////////////////////////////////////////
import java.io.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ViewRdoAnalyzedFile extends HttpServlet{
public boolean fncVerFicheroAnalizado ( HttpServletRequest request,
HttpServletResponse response) {
String bd = "orcl";
String usuario = "alex14";
String password = "alex14";
String url = "jdbc:oracle:thin:@196.154.4.189:1521:"+bd;
Connection conn = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url,usuario,password);
String strCod_analisis = (String)
request.getAttribute("analisis");
int intCod_analisis =
Integer.parseInt(strCod_analisis);
Statement stmt =
conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rsRdosAnalisis = stmt.executeQuery ("SELECT
NUM_MUTA, CAL_MUTA, CAL_NOMBRE, POLI, OUT, ROUND(X,2) X, ROUND(Y,2) Y
FROM tablasfg WHERE codigo = " + intCod_analisis );
boolean blnUltimoRdos = rsRdosAnalisis.last();
int intContadorRegistrosRdos = rsRdosAnalisis.getRow();
rsRdosAnalisis.beforeFirst();
String [][] astrRdoAnalisis = new
String[intContadorRegistrosRdos][11];
String strNumMutation;
String strCalMutNombre;
String strCalMutado;
String strPolimorfismo;
String strOutRank;
String strX;
String strY;
while(rsRdosAnalisis.next()){
strNumMutation = rsRdosAnalisis.getString("NUM_MUTA");
strCalMutado = rsRdosAnalisis.getString("CAL_MUTA");
strCalMutNombre = rsRdosAnalisis.getString("CAL_NOMBRE");
strPolimorfismo = rsRdosAnalisis.getString("POLI");
strOutRank = rsRdosAnalisis.getString("OUT");
strX = rsRdosAnalisis.getString("X");
strY = rsRdosAnalisis.getString("Y");
astrRdoAnalisis[i][0] = strCalMutNombre;
astrRdoAnalisis[i][1] = strCalMutado;
astrRdoAnalisis[i][2] = strPolimorfismo;
astrRdoAnalisis[i][3] = strOutRank;
astrRdoAnalisis[i][4] = strX;
astrRdoAnalisis[i][5] = strY;
i++;
}
rsRdosAnalisis.close();
conn.close();
request.setAttribute("astrRdoAnalisis", astrRdoAnalisis);
RequestDispatcher rd =
request.getRequestDispatcher("/analyz.jsp");
rd.forward(request,response);
return true;
} // end try
catch(Exception ex) {
return false;
}
} //end de la funcion
public void doPost(HttpServletRequest request,HttpServletResponse
response)
throws ServletException,IOException{
boolean blnMostrar = fncVerFicheroAnalizado( request,
response);
}
}
///////////////////////////////////////////////////////////////////////////­­/////////////////////////////
the JSP (analyz.jsp) has the next code::
///////////////////////////////////////////////////////////////////////////­­/////////////////////
<[EMAIL PROTECTED] contentType="application/vnd.ms-excel"%>
<%@ page language="java" import="java.io.*"%>
THE RESULT ARE:
<%
String[][] astrRdoAnalisis = (String[][])
request.getAttribute("astrRdoAnalisis");
for (int i=0; i<astrRdoAnalisis.length; i++) {
out.write(astrRdoAnalisis[i][0] + "\t" );
out.write(astrRdoAnalisis[i][1] + "\t" );
out.write(astrRdoAnalisis[i][2] + "\t" );
out.write(astrRdoAnalisis[i][3] + "\t" );
out.write(astrRdoAnalisis[i][4] + "\t" );
out.write(astrRdoAnalisis[i][5] + "\t" );
out.write("\n");
}
%>
---------------------------------
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
---------------------------------
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]