Generating excel sheets through JSP

R

ruds

Hi,
I have previously created excel sheets in JSP in weblogic, and i get
the result accurately.
I had used;
<%@ page contentType="application/vnd.ms-excel" import="java.sql.*"
language="java"%>
at the top of the page and,
<meta http-equi="Content-Type" content="application/vnd.ms-excel;
charset=iso-8859-1">
in the head tag of my page.
Now I'm using tomcat 5.5 and this is just not working....
Can someone help me out with this?
 
A

Andrew Thompson

the file is getting created but the data is not there..

Thanks for clarifying. Now hopefully someone* who
is experienced with WebSphere and Tomcat can explain
the difference in behaviour.

( * I can offer no useful suggestions, so I will bow
out of the thread now. Hope you get it sorted. )
 
A

Andrew Thompson

( * I can offer no useful suggestions, ..

But now I think about it, I will ask a general
question re JSP of anybody that can answer it.

Is there any chance of 'swallowing exceptions'
within a JSP? I did some JSP, but my recollection
is fuzzy.

And to the OP. Do you understand what I mean by
'swallow exceptions'? OK.. since I'm here, the
general form would be

try {
// something that might fail
catch(Exception e) {
//do nothing useful with the information
// and continue
}

That owuld be 'swallowing an exception'.

Whereas the way to do the opposite (*not*
swallow exceptions) would be to..

try {
// something that might fail
catch(Exception e) {
// be very verbose about what went wrong
e.printStackTrace();
}

How long is the JSP file? If it is short, it
may pay to post it to this thread.
 
D

diz4tech

Is there any chance of 'swallowing exceptions'
within a JSP?  I did some JSP, but my recollection
is fuzzy.

Hi Friends,

Ruds, am realy sorry- i dont have any idea abt ur query, hope somebody
else will clarify it.

Thompson,

JSTL provides library tags to maintain Exceptions in JSP pages
& is

<%@ taglib prefix="c" uri="http://www.java.sun.com/jsp/jstl/core" %>

<c:catch var="sampleExc">

- code -

</c:catch>

By this JSP container will handle the exception, using the custom var
we can able to display the type of error occured in the later part of
the code.

Thank you,
 
R

Roger Lindsjö

Andrew said:
But now I think about it, I will ask a general
question re JSP of anybody that can answer it.

Is there any chance of 'swallowing exceptions'
within a JSP? I did some JSP, but my recollection
is fuzzy.

You could of course use <% try } %>
.... JSP code ...
<% } catch (Exception e) {} %>

or use JSTL core.
<c:catch var="e">
.... JSP code ...
</c:catch>
<c:if test="${e != null}">
Exception ${e}
</c:if>
 
M

Mark Space

ruds said:
Hi,
I have previously created excel sheets in JSP in weblogic, and i get
the result accurately.
I had used;
<%@ page contentType="application/vnd.ms-excel" import="java.sql.*"
language="java"%>
at the top of the page and,
<meta http-equi="Content-Type" content="application/vnd.ms-excel;
charset=iso-8859-1">
in the head tag of my page.
Now I'm using tomcat 5.5 and this is just not working....
Can someone help me out with this?

Can you show us the complete JSP? That would be a start.
 
A

Arne Vajhøj

Andrew said:
But now I think about it, I will ask a general
question re JSP of anybody that can answer it.

Is there any chance of 'swallowing exceptions'
within a JSP? I did some JSP, but my recollection
is fuzzy.

It is possible to catch exceptions in Java code embedded
in or called from a JSP page.

It is also possible to redirect to an error page
in case of an exception.

My assumption would be that if someone is capable of using
either of those techniques, then are also able to
troubleshoot effectively. They are not something that
get added standard.

Arne
 
A

Arne Vajhøj

ruds said:
I have previously created excel sheets in JSP in weblogic, and i get
the result accurately.
I had used;
<%@ page contentType="application/vnd.ms-excel" import="java.sql.*"
language="java"%>
at the top of the page and,
<meta http-equi="Content-Type" content="application/vnd.ms-excel;
charset=iso-8859-1">
in the head tag of my page.
Now I'm using tomcat 5.5 and this is just not working....

Are you generating CSV or XLS format ?

Generating XLS format from JSP is error prone. You should
use a servlet for that.

Generating CSV should be possible from JSP even though I would
still recommend a servlet.

An empty file has nothing to do with the content type, so
we need more info.

Arne
 
T

Tim Smith

Thanks for clarifying. Now hopefully someone* who
is experienced with WebSphere and Tomcat can explain
the difference in behaviour.

( * I can offer no useful suggestions, so I will bow
out of the thread now. Hope you get it sorted. )

Empty output is sorted, so he's OK there. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top